{"thread":{"id":"6510","subject":"Problem with git push over <hostname>:/path protocol (ssh)","startedAt":"2007-01-24T19:48:43Z","lastAt":"2007-01-24T21:33:09Z","messageCount":7,"participants":["Bill Lear","Daniel Barkalow","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"32549","messageId":"17847.47131.694158.247941@lisa.zopyra.com","threadId":"6510","inReplyTo":null,"subject":"Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-24T19:48:43Z","receivedAt":"2007-01-24T19:48:43Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"We are seeing very strange behavior with git (1.4.4.1, and 1.5.0-rc2)\nthat results in a push to a remote repo leaving modified files in\nthe remote repo.  Here is the gist (slightly edited for clarity):\n\nOn machine1:\n\n% mkdir git_it\n% git init-db\n% echo lksjdflksdf > foo\n% git add foo\n% git commit -a -m foo\n% git status\n[nothing, all clear]\n\nOn machine2:\n\n% git clone machine1:/path/to/git_it\nInitialized empty Git repository in /home/blear/tst/git_it/.git/\nremote: Generating pack...\nremote: Done counting 3 objects.\nremote: Deltifying 3 objects.\nremote:  100% (3/3) done\nremote: Total 3, written 3 (delta 0), reused 0 (delta 0)\nIndexing 3 objects.\n 100% (3/3) done\n% cd git_it\n% git co -b new_branch\n% echo -e \"\\nbar fig dongle\\n\" >> foo\n% git commit -a -m foo\nCreated commit 082d40b1906eecc8a26f6e6e5500c476a8e4311f\n 1 files changed, 3 insertions(+), 0 deletions(-)\n% git co master\n% git pull . new_branch\nUpdating f404614..082d40b\nFast forward\n foo |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n% git push\nupdating 'refs/heads/master'\n  from f4046144d031a779c7127b01ce6241fd66eb9f54\n  to   082d40b1906eecc8a26f6e6e5500c476a8e4311f\nGenerating pack...\nDone counting 5 objects.\nResult has 3 objects.\nDeltifying 3 objects.\n 100% (3/3) done\nWriting 3 objects.\n 100% (3/3) done\nTotal 3 (delta 0), reused 0 (delta 0)\nUnpacking 3 objects\nrefs/heads/master: f4046144d031a779c7127b01ce6241fd66eb9f54 -> 082d40b1906eecc8a26f6e6e5500c476a8e4311f\n\nOn machine1:\n\n% cd git_it\n% git status\n# Updated but not checked in:\n#   (will commit)\n#\n#       modified:   foo\n#\n% cat foo\nfoo\n% git diff --cached\ndiff --git a/foo b/foo\nindex 5b9d7b1..0155b25 100644\n--- a/foo\n+++ b/foo\n@@ -1,4 +1 @@\n lksjdflksdf\n-\n-bar fig dongle\n-\n\nSo, if the developer then commits on his branch on machine 1, all his\nchanges get undone.  This has happened to him consistently --- he is\nrunning git 1.4.4.1 throughout.  I just reproduced it using the above,\nand I am using 1.5.0-rc2 on machine 2, and 1.4.4.1 on machine 1.\n\n\nBill\n"},{"id":"32552","messageId":"Pine.LNX.4.64.0701241453410.20138@iabervon.org","threadId":"6510","inReplyTo":"17847.47131.694158.247941@lisa.zopyra.com","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2007-01-24T20:04:54Z","receivedAt":"2007-01-24T20:04:54Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 24 Jan 2007, Bill Lear wrote:\n\n> We are seeing very strange behavior with git (1.4.4.1, and 1.5.0-rc2)\n> that results in a push to a remote repo leaving modified files in\n> the remote repo.  Here is the gist (slightly edited for clarity):\n> \n> On machine1:\n> \n> % mkdir git_it\n> % git init-db\n> % echo lksjdflksdf > foo\n> % git add foo\n> % git commit -a -m foo\n> % git status\n> [nothing, all clear]\n> \n> On machine2:\n> \n> % git clone machine1:/path/to/git_it\n> Initialized empty Git repository in /home/blear/tst/git_it/.git/\n> remote: Generating pack...\n> remote: Done counting 3 objects.\n> remote: Deltifying 3 objects.\n> remote:  100% (3/3) done\n> remote: Total 3, written 3 (delta 0), reused 0 (delta 0)\n> Indexing 3 objects.\n>  100% (3/3) done\n> % cd git_it\n> % git co -b new_branch\n> % echo -e \"\\nbar fig dongle\\n\" >> foo\n> % git commit -a -m foo\n> Created commit 082d40b1906eecc8a26f6e6e5500c476a8e4311f\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n> % git co master\n> % git pull . new_branch\n> Updating f404614..082d40b\n> Fast forward\n>  foo |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n> % git push\n> updating 'refs/heads/master'\n>   from f4046144d031a779c7127b01ce6241fd66eb9f54\n>   to   082d40b1906eecc8a26f6e6e5500c476a8e4311f\n> Generating pack...\n> Done counting 5 objects.\n> Result has 3 objects.\n> Deltifying 3 objects.\n>  100% (3/3) done\n> Writing 3 objects.\n>  100% (3/3) done\n> Total 3 (delta 0), reused 0 (delta 0)\n> Unpacking 3 objects\n> refs/heads/master: f4046144d031a779c7127b01ce6241fd66eb9f54 -> 082d40b1906eecc8a26f6e6e5500c476a8e4311f\n> \n> On machine1:\n> \n> % cd git_it\n> % git status\n> # Updated but not checked in:\n> #   (will commit)\n> #\n> #       modified:   foo\n> #\n> % cat foo\n> foo\n> % git diff --cached\n> diff --git a/foo b/foo\n> index 5b9d7b1..0155b25 100644\n> --- a/foo\n> +++ b/foo\n> @@ -1,4 +1 @@\n>  lksjdflksdf\n> -\n> -bar fig dongle\n> -\n> \n> So, if the developer then commits on his branch on machine 1, all his\n> changes get undone.  This has happened to him consistently --- he is\n> running git 1.4.4.1 throughout.  I just reproduced it using the above,\n> and I am using 1.5.0-rc2 on machine 2, and 1.4.4.1 on machine 1.\n\nGit gets unhappy if you push into a branch that's checked out. It doesn't \nupdate the index or working directory, so the state after the push looks \nlike the user reverted the patch in the working directory and updated the \nindex.\n\nIt should probably give an error message and stop the push; dealing with a \nchecked out version conceptually requires a merge, which push doesn't do. \nMost likely, you want a clone of the upstream repository, and a \npost-update hook in the upstream repository that goes into the clone and \npulls the changes. (And possibly does more stuff after that)\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"32554","messageId":"17847.49939.964820.170771@lisa.zopyra.com","threadId":"6510","inReplyTo":"Pine.LNX.4.64.0701241453410.20138@iabervon.org","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-24T20:35:31Z","receivedAt":"2007-01-24T20:35:31Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, January 24, 2007 at 15:04:54 (-0500) Daniel Barkalow writes:\n>...\n>Git gets unhappy if you push into a branch that's checked out. It doesn't \n>update the index or working directory, so the state after the push looks \n>like the user reverted the patch in the working directory and updated the \n>index.\n>\n>It should probably give an error message and stop the push; dealing with a \n>checked out version conceptually requires a merge, which push doesn't do. \n>Most likely, you want a clone of the upstream repository, and a \n>post-update hook in the upstream repository that goes into the clone and \n>pulls the changes. (And possibly does more stuff after that)\n\nWow, this is a pain.\n\nWe actually would prefer that our public (collaborative) repositories\nbe bare, but we could not find a way to pull into them without\ngetting all the files checked out into the working tree.\n\nIs there a way to do a pull and leave a repo bare, perchance?\n\n\nBill\n"},{"id":"32553","messageId":"ep8fss$dlf$1@sea.gmane.org","threadId":"6510","inReplyTo":"Pine.LNX.4.64.0701241453410.20138@iabervon.org","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-24T20:35:36Z","receivedAt":"2007-01-24T20:35:36Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Daniel Barkalow wrote:\n\n>> So, if the developer then commits on his branch on machine 1, all his\n>> changes get undone.  This has happened to him consistently --- he is\n>> running git 1.4.4.1 throughout.  I just reproduced it using the above,\n>> and I am using 1.5.0-rc2 on machine 2, and 1.4.4.1 on machine 1.\n> \n> Git gets unhappy if you push into a branch that's checked out. It doesn't \n> update the index or working directory, so the state after the push looks \n> like the user reverted the patch in the working directory and updated the \n> index.\n\nSo you usually push into _bare_ repository, or use fetch / pull instead.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"32557","messageId":"17847.50232.211128.994275@lisa.zopyra.com","threadId":"6510","inReplyTo":"ep8fss$dlf$1@sea.gmane.org","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-24T20:40:24Z","receivedAt":"2007-01-24T20:40:24Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, January 24, 2007 at 21:35:36 (+0100) Jakub Narebski writes:\n>Daniel Barkalow wrote:\n>\n>>> So, if the developer then commits on his branch on machine 1, all his\n>>> changes get undone.  This has happened to him consistently --- he is\n>>> running git 1.4.4.1 throughout.  I just reproduced it using the above,\n>>> and I am using 1.5.0-rc2 on machine 2, and 1.4.4.1 on machine 1.\n>> \n>> Git gets unhappy if you push into a branch that's checked out. It doesn't \n>> update the index or working directory, so the state after the push looks \n>> like the user reverted the patch in the working directory and updated the \n>> index.\n>\n>So you usually push into _bare_ repository, or use fetch / pull instead.\n\nWell, what we want to do is have a public repo as a collaborative hub.\nWe would prefer this be bare.  However, there are problems with that,\nat least with how we are doing things.\n\nFor example, if I collaborate with a peer and make a few changes,\nI want to push my changes to my public repo and have an email sent\nto him, and any other interested persons, when the update hook runs.\n\nHowever, if I keep my private repo up-to-date with our company repo by\ndoing periodic pulls into it, and then push into my public repo, ALL\nof the changes get noticed on the public repo side, and he gets a\nflood of mail.  This also happens if I pull from my peer's repo into\nmy private repo, make changes, and then push to my public repo --- all\nof his changes then get sent out to him again, and mine get mixed in\nwith his.\n\nSo, we resorted to using a non-bare public repo into which we could\npull, to avoid this mess, and it appears, actually, that we have\ncreated a worse one.\n\n\nBill\n"},{"id":"32558","messageId":"ep8gdc$dlf$2@sea.gmane.org","threadId":"6510","inReplyTo":"17847.49939.964820.170771@lisa.zopyra.com","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-01-24T20:44:24Z","receivedAt":"2007-01-24T20:44:24Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Lear wrote:\n\n> Is there a way to do a pull and leave a repo bare, perchance?\n\nfetch\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"32565","messageId":"17847.53397.545594.827671@lisa.zopyra.com","threadId":"6510","inReplyTo":"ep8gdc$dlf$2@sea.gmane.org","subject":"Re: Problem with git push over <hostname>:/path protocol (ssh)","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-01-24T21:33:09Z","receivedAt":"2007-01-24T21:33:09Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, January 24, 2007 at 21:44:24 (+0100) Jakub Narebski writes:\n>Bill Lear wrote:\n>\n>> Is there a way to do a pull and leave a repo bare, perchance?\n>\n>fetch\n\nNo way, you mean I'm really that dumb!?  Geez, sometimes it doesn't\npay to stay up until 6am coding...\n\nThanks for what should have been obvious.\n\n\nBill\n"}]}