{"thread":{"id":"29361","subject":"Commit changes to remote repository","startedAt":"2012-01-13T20:29:49Z","lastAt":"2012-01-17T00:12:30Z","messageCount":4,"participants":["ruperty","Carlos Martín Nieto","Matthieu Moy","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"182522","messageId":"1326486589088-7185551.post@n2.nabble.com","threadId":"29361","inReplyTo":null,"subject":"Commit changes to remote repository","fromName":"ruperty","fromEmail":"rupert@moonsit.co.uk","sentAt":"2012-01-13T20:29:49Z","receivedAt":"2012-01-13T20:29:49Z","isPatch":false,"sender":{"key":"rupert@moonsit.co.uk","avatar":null},"body":"Being new to git I am probably not doing things correctly so pointers in the\nright direction would be useful.\n\nWhat I want to do make changes on my laptop and commit them to a remote\nrepository. Here is what I have done,\n\n1. Created a repository on my remote linux host, in a folder of cource code,\nby,\n\n   git init\n   git add *\n   git commit\n\n2. On my laptop I did a git clone pointing by ssh to the remote repo which\ndownloaded all the files to my local system.\n\n3. I changed a file locally and did a commit.\n\n4. I then wanted to update the remote repo with my change, which I did with\na git push, but that didn't work, getting this error,\n\n    remote: error: refusing to update checked out branch:\nrefs/heads/master\u001b[K\n    remote: error: By default, updating the current branch in a non-bare\nrepository\u001b[K.......\n\n\nWhat am I doing wrong?\n\nI was following the tutorial at\nhttp://book.git-scm.com/3_distributed_workflows.html\n\nI did search for this issue in this list but didn't understand the\nresponses.\n\nRupert\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/Commit-changes-to-remote-repository-tp7185551p7185551.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"182544","messageId":"20120114113141.GG2850@centaur.lab.cmartin.tk","threadId":"29361","inReplyTo":"1326486589088-7185551.post@n2.nabble.com","subject":"Re: Commit changes to remote repository","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2012-01-14T11:31:41Z","receivedAt":"2012-01-14T11:31:41Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Fri, Jan 13, 2012 at 12:29:49PM -0800, ruperty wrote:\n> Being new to git I am probably not doing things correctly so pointers in the\n> right direction would be useful.\n> \n> What I want to do make changes on my laptop and commit them to a remote\n> repository. Here is what I have done,\n> \n> 1. Created a repository on my remote linux host, in a folder of cource code,\n> by,\n> \n>    git init\n>    git add *\n>    git commit\n> \n> 2. On my laptop I did a git clone pointing by ssh to the remote repo which\n> downloaded all the files to my local system.\n> \n> 3. I changed a file locally and did a commit.\n> \n> 4. I then wanted to update the remote repo with my change, which I did with\n> a git push, but that didn't work, getting this error,\n> \n>     remote: error: refusing to update checked out branch:\n> refs/heads/master\u001b[K\n>     remote: error: By default, updating the current branch in a non-bare\n> repository\u001b[K.......\n> \n> \n> What am I doing wrong?\n\nYou're trying to push to a non-bare repository and change the\ncurrently active branch, which can cause problems, so git isn't\nletting you. There's an explanation of bare and non-bare at\nhttp://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that\nyou should init the repo you want to use as the central point with\n--bare and do modifications locally and then push there.\n\n   cmn\n"},{"id":"182553","messageId":"vpqboq6fjfy.fsf@bauges.imag.fr","threadId":"29361","inReplyTo":"20120114113141.GG2850@centaur.lab.cmartin.tk","subject":"Re: Commit changes to remote repository","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-01-14T14:27:29Z","receivedAt":"2012-01-14T14:27:29Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Carlos Martín Nieto <cmn@elego.de> writes:\n\n> You're trying to push to a non-bare repository and change the\n> currently active branch, which can cause problems, so git isn't\n> letting you. There's an explanation of bare and non-bare at\n> http://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that\n> you should init the repo you want to use as the central point with\n> --bare and do modifications locally and then push there.\n\nAn alternative is to push to a temporary, non-checked-out branch.\n\nI sometimes do\n\n  laptop$ git push desktop HEAD:incomming\n\nand then\n\n  desktop$ git merge incomming\n\nThe push does not disturb the worktree on the desktop, and the merge is\ndone manually on the receiving machine.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"182657","messageId":"7vpqejtcep.fsf@alter.siamese.dyndns.org","threadId":"29361","inReplyTo":"vpqboq6fjfy.fsf@bauges.imag.fr","subject":"Re: Commit changes to remote repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-01-17T00:12:30Z","receivedAt":"2012-01-17T00:12:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Carlos Martín Nieto <cmn@elego.de> writes:\n>\n>> You're trying to push to a non-bare repository and change the\n>> currently active branch, which can cause problems, so git isn't\n>> letting you. There's an explanation of bare and non-bare at\n>> http://bare-vs-nonbare.gitrecipes.de/ but the short and sweet is that\n>> you should init the repo you want to use as the central point with\n>> --bare and do modifications locally and then push there.\n>\n> An alternative is to push to a temporary, non-checked-out branch.\n\nOr more generally, treat such a push as if you are pulling in the opposite\ndirection. So in this example,\n\n> I sometimes do\n>\n>   laptop$ git push desktop HEAD:incomming\n>\n> and then\n>\n>   desktop$ git merge incomming\n\nyou pretend as if you are running \"git pull\" on your desktop in order to\nintegrate the work done on your laptop. If you did\n\n    desktop$ git pull laptop\n\nyou would store where the branches on the laptop are in the remote\ntracking branches for \"laptop\" remote in your desktop's repository.\n\nSo a good way to simulate that would be:\n\n    laptop$ git push desktop master:refs/remotes/laptop/master\n\nand then run:\n\n    desktop$ git merge laptop/master\n\n> The push does not disturb the worktree on the desktop, and the merge is\n> done manually on the receiving machine.\n"}]}