{"thread":{"id":"30135","subject":"How to create empty CENTRAL git with master / development branch ?","startedAt":"2012-04-03T10:53:52Z","lastAt":"2012-04-04T18:07:55Z","messageCount":7,"participants":["J. Bakshi","Holger Hellmuth","Tomas Carnecky","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188402","messageId":"20120403162352.67cb165e@shiva.selfip.org","threadId":"30135","inReplyTo":null,"subject":"How to create empty CENTRAL git with master / development branch ?","fromName":"J. Bakshi","fromEmail":"joydeep.bakshi@infoservices.in","sentAt":"2012-04-03T10:53:52Z","receivedAt":"2012-04-03T10:53:52Z","isPatch":false,"sender":{"key":"joydeep.bakshi@infoservices.in","avatar":null},"body":"Dear list,\n\nI need to create git repos on a remote server by the command executed on that server\nthrough ssh as\n\n` ` ` ` `\ngit --bare init project_name.git\n\n` ` ` ` `\n\nHow can I also add the master branch, so that users don't need to\nexecute  [ git push origin master ]  ?\n\nThanks\n"},{"id":"188418","messageId":"4F7B0F1B.3000304@ira.uka.de","threadId":"30135","inReplyTo":"20120403162352.67cb165e@shiva.selfip.org","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-04-03T14:54:19Z","receivedAt":"2012-04-03T14:54:19Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"On 03.04.2012 12:53, J. Bakshi wrote:\n> Dear list,\n>\n> I need to create git repos on a remote server by the command executed on that server\n> through ssh as\n>\n> ` ` ` ` `\n> git --bare init project_name.git\n\nyou probably meant \"git init --bare project_name.git\"\n\n> How can I also add the master branch, so that users don't need to\n> execute  [ git push origin master ]  ?\n\nWhat else do you want them to execute? \"git init --bare\" creates an \nempty repository. Without pushing to it it will always stay empty\n\nGenerally: If you want a central repository, the first one to push to it \nmight do something like this:\n\ngit remote add origin ssh://big.brother.edu/repo.git\ngit push origin master\ngit config branch.master.remote origin\ngit config branch.master.merge refs/heads/master\n\nEveryone else could do\n\ngit clone ssh://big.brother.edu/repo.git\n\nNow everyone will push to the repository master when they do \"git push\".\n\nIs that what you wanted to know?\n"},{"id":"188419","messageId":"1333466542-ner-2699@calvin","threadId":"30135","inReplyTo":"4F7B0F1B.3000304@ira.uka.de","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"Tomas Carnecky","fromEmail":"tomas.carnecky@gmail.com","sentAt":"2012-04-03T15:22:22Z","receivedAt":"2012-04-03T15:22:22Z","isPatch":false,"sender":{"key":"tomas.carnecky@gmail.com","avatar":null},"body":"On Tue, 03 Apr 2012 16:54:19 +0200, Holger Hellmuth <hellmuth@ira.uka.de> wrote:\n> Generally: If you want a central repository, the first one to push to it \n> might do something like this:\n> \n> git remote add origin ssh://big.brother.edu/repo.git\n> git push origin master\n> git config branch.master.remote origin\n> git config branch.master.merge refs/heads/master\n\nor simply: git push -u origin master\n\ntom\n"},{"id":"188472","messageId":"201204040711.q347BTXg025316@VM-MailSafe-02.soltecsis.com","threadId":"30135","inReplyTo":"4F7B0F1B.3000304@ira.uka.de","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"J. Bakshi","fromEmail":"joydeep.bakshi@infoservices.in","sentAt":"2012-04-04T07:11:22Z","receivedAt":"2012-04-04T07:11:22Z","isPatch":false,"sender":{"key":"joydeep.bakshi@infoservices.in","avatar":null},"body":"On Tue, 03 Apr 2012 16:54:19 +0200\nHolger Hellmuth <hellmuth@ira.uka.de> wrote:\n\n> On 03.04.2012 12:53, J. Bakshi wrote:\n> > Dear list,\n> >\n> > I need to create git repos on a remote server by the command executed on that server\n> > through ssh as\n> >\n> > ` ` ` ` `\n> > git --bare init project_name.git\n> \n> you probably meant \"git init --bare project_name.git\"\n\nYes right. Sorry for the mistake.\n\n> \n> > How can I also add the master branch, so that users don't need to\n> > execute  [ git push origin master ]  ?\n> \n> What else do you want them to execute? \"git init --bare\" creates an \n> empty repository. Without pushing to it it will always stay empty\n> \n> Generally: If you want a central repository, the first one to push to it \n> might do something like this:\n> \n> git remote add origin ssh://big.brother.edu/repo.git\n> git push origin master\n> git config branch.master.remote origin\n> git config branch.master.merge refs/heads/master\n> \n> Everyone else could do\n> \n> git clone \n> \n> Now everyone will push to the repository master when they do \"git push\".\n> \n> Is that what you wanted to know?\n\nwell.... I like to create the master just after creating the bare repo.\nSo that the users can just start working on it without \"git push origin master\"\nAs I can already ssh into the central git server, I don't need any further\nssh://big.brother.edu/repo.git\n\nSo what should I do after creating a bare empty repo to generate the master\nthere ?\n\n# git init --bare project_name.git\n\n# cd project_name.git\n\n.... and can I execute here any command to add master ?\n\nThanks\n"},{"id":"188500","messageId":"7vhawza046.fsf@alter.siamese.dyndns.org","threadId":"30135","inReplyTo":"201204040711.q347BTXg025316@VM-MailSafe-02.soltecsis.com","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-04T17:16:25Z","receivedAt":"2012-04-04T17:16:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"J. Bakshi\" <joydeep.bakshi@infoservices.in> writes:\n\n> On Tue, 03 Apr 2012 16:54:19 +0200\n> Holger Hellmuth <hellmuth@ira.uka.de> wrote:\n>\n>> > git --bare init project_name.git\n>> \n>> you probably meant \"git init --bare project_name.git\"\n>\n> Yes right. Sorry for the mistake.\n\nJust on this part.  \"git --bare init\" is technially more kosher, but it\nlooks somewhat strange, so \"git init\" has a special case code to pretend\nas if the user said \"git --bare init\" when \"git init --bare\" was given.\n\nSo both should work fine.\n"},{"id":"188503","messageId":"4F7C8C31.7050206@ira.uka.de","threadId":"30135","inReplyTo":"201204040711.q347BTXg025316@VM-MailSafe-02.soltecsis.com","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-04-04T18:00:17Z","receivedAt":"2012-04-04T18:00:17Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"On 04.04.2012 09:11, J. Bakshi wrote:\n> well.... I like to create the master just after creating the bare repo.\n> So that the users can just start working on it without \"git push origin master\"\n\nBut what do you mean by working on it? The users don't work on the \ncentral repository, everyone has his own repository. And when this user \nwants to put something into the central repository he needs to push\n\n> As I can already ssh into the central git server, I don't need any further\n> ssh://big.brother.edu/repo.git\n>\n> So what should I do after creating a bare empty repo to generate the master\n> there ?\n\nI can give you two answers to that, both somewhat true:\n\n1) The master branch already exists, HEAD already points to it (look \ninto the file HEAD).\n\n2) Without a commit that master can point to a master branch can't \nexist. You first have to have a commit that you put into this \nrepository. Since it is bare you can't use \"git add\"+\"git commit\" you \nhave to push it from some other repository\n\nA branch is like a pointer in a programming language, it points to a \ncommit. If you don't have any commits, the pointer is NIL. I don't know \nif git has any use for NIL pointers (i.e. an empty /refs/heads/master \nfile), but no file refs/heads/master or an empty file refs/heads/master \nmeans practically the same as having the NIL value (as far as I know)\n\n\nInstead of \"git push -u\" you could also clone the bare repository from \nsomewhere (it will give a warning), add a file (for example \".gitignore\" \nif you want to keep the repository practically empty), commit, and push. \nYou can do this locally on the server if you want to.\n"},{"id":"188505","messageId":"4F7C8DFB.2070007@ira.uka.de","threadId":"30135","inReplyTo":"201204040711.q347BTXg025316@VM-MailSafe-02.soltecsis.com","subject":"Re: How to create empty CENTRAL git with master / development branch ?","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-04-04T18:07:55Z","receivedAt":"2012-04-04T18:07:55Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"On 04.04.2012 09:11, J. Bakshi wrote:\n\nPS: I always get an error message from your email provider:\n-----------------------\n   joydeep.bakshi@infoservices.in\n     all relevant MX records point to non-existent hosts or (invalidly) \nto IP addresses\n-----------------------\n\nI assume you have read my last message on gmane, so I send this to the \nkernel mailing list as well.\n"}]}