{"thread":{"id":"3214","subject":"Question around git-shell usage in Everyday Git","startedAt":"2006-02-01T23:01:55Z","lastAt":"2006-02-02T21:23:56Z","messageCount":9,"participants":["Alan Chandler","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15444","messageId":"200602012301.56141.alan@chandlerfamily.org.uk","threadId":"3214","inReplyTo":null,"subject":"Question around git-shell usage in Everyday Git","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2006-02-01T23:01:55Z","receivedAt":"2006-02-01T23:01:55Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"In the Repository Administrator section of the Everyday Git document it shows \nhow to allocate accounts to developers so that you can have fine grained \ncontrol over access to the repository (I assume it is because of that.  \nOtherwise I assume you would do what I have done, and that is create a \"git\" \nuser, with a home directory where you want to locate your repositories and \nthen tell your users to put the following sort of entry in .git/remotes/xxx\n\nURL:git@host.com:repository.git\n\nand in ~git/.ssh/authorized_keys putting all the developers public keys.\n\n).  But the example shows creating independant home directories for each of \nthe developers - but then limiting their access by giving them git-shell as \ntheir shell.\n\nI assume they would then user a .git/remotes entry of the form\nURL:host.com:/absolute/path/to/repositories\n\nMy question, in this case is there any reason (such as git creating home \ndirectoriy temp files or something) why each developer could not have their \nhome directory as the root of all the repositories (ie where my git user in \nthe above example had its home directory).\n\nThis would then mean each user (unless he had a real account on that machine) \nwould then use the following in .git/remotes\n\nURL:host.com:repository.git\n\nWhich has the advantage of not revealing exactly where on your filesystem you \nhave chosen to store the repository (or more precisely allowing you to move \nit without all users having to change their.git/remotes urls)\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"15445","messageId":"7vy80u64xf.fsf@assigned-by-dhcp.cox.net","threadId":"3214","inReplyTo":"200602012301.56141.alan@chandlerfamily.org.uk","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-01T23:21:48Z","receivedAt":"2006-02-01T23:21:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n> My question, in this case is there any reason (such as git creating home \n> directoriy temp files or something) why each developer could not have their \n> home directory as the root of all the repositories (ie where my git user in \n> the above example had its home directory).\n\nDo you mean to reuse single directory /home/gitu/ for user A, B, C,\nand hang repositories /home/gitu/{X,Y,Z} for projects?  I'd\nimagine things could be arranged that way.  User A and B but not\nC may be in \"projectX\" group and /home/gitu/X is writable only\nby projectX group members and such...\n"},{"id":"15446","messageId":"7vslr264iz.fsf@assigned-by-dhcp.cox.net","threadId":"3214","inReplyTo":"7vy80u64xf.fsf@assigned-by-dhcp.cox.net","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-01T23:30:28Z","receivedAt":"2006-02-01T23:30:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Do you mean to reuse single directory /home/gitu/ for user A, B, C,\n> and hang repositories /home/gitu/{X,Y,Z} for projects?  I'd\n> imagine things could be arranged that way.  User A and B but not\n> C may be in \"projectX\" group and /home/gitu/X is writable only\n> by projectX group members and such...\n\nOTOH, if you did things the way as you suggested:\n\n>URL:git@host.com:repository.git\n>and in ~git/.ssh/authorized_keys putting all the developers\n>public keys.\n\nyou cannot tell a person using one key to become \"git\" on that\nmachine from another person using different key to become the\nsame \"git\" on that machine; if you do not care about that\nthen it is OK.  That would work only when all of your git\nrepositories are supposed to be accessible by everybody.\n\nBut I suspect doing so would not let you have different projects\nwith different subset of \"git\" users on your shared machine.\n"},{"id":"15447","messageId":"Pine.LNX.4.64.0602011523000.21884@g5.osdl.org","threadId":"3214","inReplyTo":"200602012301.56141.alan@chandlerfamily.org.uk","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-01T23:30:35Z","receivedAt":"2006-02-01T23:30:35Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 1 Feb 2006, Alan Chandler wrote:\n> \n> My question, in this case is there any reason (such as git creating home \n> directoriy temp files or something) why each developer could not have their \n> home directory as the root of all the repositories (ie where my git user in \n> the above example had its home directory).\n\nNo reason why not.\n\nI use my home directory for all _my_ projects, and just clone them within \nmy own network with\n\n\tgit pull g5:v2.6/linux ..\n\nrather than using the absolute path-name.\n\nAnd no, git should never use your home directory for anything else (ie \nall file operations are normally done just in $GIT_OBJECT_DIR or \nsimilar: some things like \"git-diff-files\" will use the current working \ndirectory, but nothing uses $HOME (*)).\n\nSo I would indeed suggest that the home directory would be the natural \nplace to put developer projects.\n\n\t\tLinus\n\n(*) Not entirely true. \"git-cvsimport\" uses \"$HOME/.cvspass\" for CVS \npasswords. But the _basic_ git commands shouldn't do that.\n"},{"id":"15449","messageId":"Pine.LNX.4.64.0602011530530.21884@g5.osdl.org","threadId":"3214","inReplyTo":"7vy80u64xf.fsf@assigned-by-dhcp.cox.net","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-01T23:37:36Z","receivedAt":"2006-02-01T23:37:36Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 1 Feb 2006, Junio C Hamano wrote:\n> \n> Do you mean to reuse single directory /home/gitu/ for user A, B, C,\n> and hang repositories /home/gitu/{X,Y,Z} for projects?  I'd\n> imagine things could be arranged that way.  User A and B but not\n> C may be in \"projectX\" group and /home/gitu/X is writable only\n> by projectX group members and such...\n\nThat would work from a _git_ angle, but I don't think that was what Alan \nwas talking about, and it would failr horribly from a \"ssh\" perspective \n(because \"ssh\" will want $HOME/.ssh/authorized_keys etc).\n\nSo I _think_ what Alan was describing was just a \n\n\t/home/user-A/project.git\n\t\t     another-project.git\n\t\t     ya-project.git\n\t      user-B/myproject.git\n\t      user-C/..\n\nsetup, and then people can always just describe their own projects by just \ndoing \"git pull host:<projectname>\", without ever caring _where_ their \nhome directory is.\n\n(And yes, \"git pull user@host:project\" also obviously works fine, in case \nyour user name at the hosting site isn't the same as the user name on your \nlocal site).\n\nHowever, to be truly useful for this kind of hosting schenario, \n\"git-shell\" still needs to be extended to be able to at a minimum create \n(and delete) projects.\n\nIt probably also makes a lot of sense to be able to pre-populate a \nproject, so that you don't have to do a remote \"git push\" to push a big \nproject over the network, when another version of that project already \nexists at the hosting site.\n\n\t\t\tLinus\n"},{"id":"15451","messageId":"7v8xsu62xk.fsf@assigned-by-dhcp.cox.net","threadId":"3214","inReplyTo":"Pine.LNX.4.64.0602011530530.21884@g5.osdl.org","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-02T00:04:55Z","receivedAt":"2006-02-02T00:04:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Wed, 1 Feb 2006, Junio C Hamano wrote:\n>> \n>> Do you mean to reuse single directory /home/gitu/ for user A, B, C,\n>> and hang repositories /home/gitu/{X,Y,Z} for projects?  I'd\n>> imagine things could be arranged that way.  User A and B but not\n>> C may be in \"projectX\" group and /home/gitu/X is writable only\n>> by projectX group members and such...\n>\n> That would work from a _git_ angle, but I don't think that was what Alan \n> was talking about, and it would failr horribly from a \"ssh\" perspective \n> (because \"ssh\" will want $HOME/.ssh/authorized_keys etc).\n\nHmph.  I thought that was what Alan was talking about, after he\nread about the shared repository configuration section that\nmentions git-shell, which is about shared repository.\n\nProject administrator or project secretary sets up the shared\nrepository for the project and member accounts on that machine,\nand members just use that shared repository.  Not allowing\nremote repository creation nor deletion over git-shell is a\nslightly lesser issue in this context.\n\n> However, to be truly useful for this kind of hosting schenario, \n> \"git-shell\" still needs to be extended to be able to at a minimum create \n> (and delete) projects.\n\nHosting is a different story and I think branch/tag removal in\naddition to repository creation, and deletion you listed above\nare needed in that context.  Your \"my projects are all under my\nHOME directory, it is very convenient and things naturally work\"\nwould apply for non-shared (i.e. something each person can call\n\"my\") repositories, and would apply to hosting situation, of\ncourse.\n\n> It probably also makes a lot of sense to be able to pre-populate a \n> project, so that you don't have to do a remote \"git push\" to push a big \n> project over the network, when another version of that project already \n> exists at the hosting site.\n\nDepends on what you mean by pre-populate, but that may just mean\nto be able to manage objects/info/alternates remotely.\nCapability to manage hook scripts may also be needed to a\ncertain degree if the repository side access control (e.g. who\ncan push into this branch) is done by hooks/pre-update, but in\neither the hosting environment or a shared project setup, the\nmachine owner who is paranoid to install git-shell would want to\ncontrol what hooks can do very carefully.  The operator would\nprobably not allow updating of hooks at all, but install a BCP\nhook by Carl Baldwin.  The users can only manage what is in the\ninfo/allowed-{users,groups} file.\n\nWhat this implies is extending what git-shell allows is a\nconcious policy decision and probably be quite different from\nsite to site until a set of BCP emerges.\n"},{"id":"15465","messageId":"200602020517.05827.alan@chandlerfamily.org.uk","threadId":"3214","inReplyTo":"Pine.LNX.4.64.0602011530530.21884@g5.osdl.org","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2006-02-02T05:17:05Z","receivedAt":"2006-02-02T05:17:05Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Wednesday 01 February 2006 23:37, Linus Torvalds wrote:\n> On Wed, 1 Feb 2006, Junio C Hamano wrote:\n> > Do you mean to reuse single directory /home/gitu/ for user A, B, C,\n> > and hang repositories /home/gitu/{X,Y,Z} for projects?  I'd\n> > imagine things could be arranged that way.  User A and B but not\n> > C may be in \"projectX\" group and /home/gitu/X is writable only\n> > by projectX group members and such...\n>\n> That would work from a _git_ angle, but I don't think that was what Alan\n> was talking about, and it would failr horribly from a \"ssh\" perspective\n> (because \"ssh\" will want $HOME/.ssh/authorized_keys etc).\n>\n> So I _think_ what Alan was describing was just a\n>\n> \t/home/user-A/project.git\n> \t\t     another-project.git\n> \t\t     ya-project.git\n> \t      user-B/myproject.git\n> \t      user-C/..\n>\n\nActually Junio was right in layout - but I am not sure he understands what I \nwant to achieve.\n\nWhat I have in mind is that I am a personal developer at home with my own \nserver.  I have written various code in a number of projects whose public \nrepositories are all located under /var/lib/git. \n(ie /var/lib/git/projectA.git, /var/lib/git/projectB.git) and they are all \nshareable.\n\ngit-daemon is run with base-path as /var/lib/git and have defined user \"git\" \nto have a home directory of /var/lib/git and git-shell as his shell, so \nanyone can clone from them\n\nSo, if my projects take off, and I have some outside developers helping me, I \ndo not want to give them individual home directories on my server instead my \nplan_had_ been to collect their public keys at put them \nin /var/lib/git/.ssh/authorized_keys, and then tell them to push to the \nrepository via\n\nURL:git@home.chandlerfamily.org.uk:projectA.git\n\netc.\n\nThe downside of this approach is that all developers get access to all \nrepositories - maybe I need better control.\n\n\nThen I saw the howto on repository control with the update hook and was \nthinking that I could do it as follows\n\nin /etc/password create an entry for each developer with a home directory \nof /var/lib/git and git shell. (so I DO NOT create a large number of /home \ndirectories at all) and make them members of group git.\n\nThen each developer would access the repository via\n\nURL:home.chandlerfamily.org.uk:projectx.git\n\nbut would be only allowed access if they were on a white list within each \nproject.\n\nThats when I asked the question that started this thread.  \n\nSince then I have realised that the downside of this is that its pretty easy \nto fake being someone else and getting access by just giving someone elses \nname.\n\nSo the third approach I am now contemplating is to actually create separate \nusers for each project\n\nso user projectA had a home directory of /var/lib/git/projectA.git with a \nsubdirectory of .ssh for the authorized keys file.\n\nSuper users (e.g. ME) would have their keys \nin /var/lib/git/.ssh/authorized_keys\n\nIndividual project developers would have their keys in \n\n/var/lib/git/projectA.git/.ssh/authorized_keys etc\n\nand would access the repository with\n\nURL:ProjectA@home.chandlerfamily.org.uk:.\n\n \n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"},{"id":"15466","messageId":"7vbqxqxqk7.fsf@assigned-by-dhcp.cox.net","threadId":"3214","inReplyTo":"200602020517.05827.alan@chandlerfamily.org.uk","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-02T05:44:40Z","receivedAt":"2006-02-02T05:44:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n> Then each developer would access the repository via\n>\n> URL:home.chandlerfamily.org.uk:projectx.git\n>\n> but would be only allowed access if they were on a white list within each \n> project.\n\nThis is the part I highly doubt is doable -- without having\nseparate unix level UID your whitelist mechanism would not work.\nAnd I do not think you would get separate unix level UID without\nhaving separate $HOME/.ssh directory, even if you have prepared\nseparate unix level UID in your /etc/passwd file.\n\nCome to think of it, it is worse than that.  IIRC, sshd has\nrather strict check to make sure that only one unix user can\nwrite into $HOME/.ssh/ directory (obviously the owner of that\n$HOME directory, which means the user who has the directory as\nher home directory in /etc/passwd).  If more than one unix level\nuser shares a home directory, I do not think you can satisfy\nthat checking.\n\nMaybe it does not matter, since they will be pushing the commits\nwith their name set to committer/author fields and if you trust\nthem, but then there is no point assigning one UID per user.\n\nOne UID per project is probably doable but I do not think that\nis a useful arrangement either.\n\n> So the third approach I am now contemplating is to actually create separate \n> users for each project\n\nYou still cannot distinguish your users in a project with each\nother, which may or may not matter to you.  Also this is\ninconvenient for your developer who works on more than one of\nyour projects -- I think he needs to use one project identity\nfor each.\n\nSo in short, I am mildly negative about this.  If I were doing\nthis kind of thing I'd have one unix UID and one directory per\none physical user.  What is the real reason (other than \"I just\ndo not want to\" feeling) you want to have smaller number of home\ndirectories than you have users?\n"},{"id":"15500","messageId":"200602022123.57120.alan@chandlerfamily.org.uk","threadId":"3214","inReplyTo":"7vbqxqxqk7.fsf@assigned-by-dhcp.cox.net","subject":"Re: Question around git-shell usage in Everyday Git","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2006-02-02T21:23:56Z","receivedAt":"2006-02-02T21:23:56Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Thursday 02 February 2006 05:44, Junio C Hamano wrote:\n...\n>\n> So in short, I am mildly negative about this.  If I were doing\n> this kind of thing I'd have one unix UID and one directory per\n> one physical user.  What is the real reason (other than \"I just\n> do not want to\" feeling) you want to have smaller number of home\n> directories than you have users?\n\nYou are right.  I don't know whether you can tell, but I wrote my last note at \njust gone 5:00am my time this moring  after getting up to go an catch a \nflight to Germany for the day.  I spent the flight and the wait for the \nflight back going over the options in my mind and I NOW think it better to \nhave proper home directories.\n\nI do have to say, my motivation originally was more about not announcing to \nthe world the internal structure of my filesystem rather than the limitation \naround creating lots of home directories, but part of the reasoning to myself \ntoday was that that probably doesn't really matter.\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\nOpen Source. It's the difference between trust and antitrust.\n"}]}