{"thread":{"id":"48469","subject":"Bug report for git push","startedAt":"2018-05-12T02:45:22Z","lastAt":"2018-05-12T08:45:28Z","messageCount":2,"participants":["Surenkumar Nihalani","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"347405","messageId":"27C6F6E9-2F80-48A6-B551-4AE9957C98A5@icloud.com","threadId":"48469","inReplyTo":null,"subject":"Bug report for git push","fromName":"Surenkumar Nihalani","fromEmail":"suren.k.n@icloud.com","sentAt":"2018-05-12T01:44:54Z","receivedAt":"2018-05-12T02:45:22Z","isPatch":false,"sender":{"key":"suren.k.n@icloud.com","avatar":null},"body":"Hi everyone!\n\nI am facing this spurious issue (not easily reproducible and usually a retry fixes it) with git push:\n\nWarning: Permanently added 'github.com,192.30.255.112' (RSA) to the list of known hosts.\nCounting objects: 8, done.\nDelta compression using up to 2 threads.\nCompressing objects: 100% (8/8), done.\nWriting objects: 100% (8/8), 971 bytes | 971.00 KiB/s, done.\nTotal 8 (delta 7), reused 0 (delta 0)\nremote: Resolving deltas:   0% (0/7)\nremote: Resolving deltas:  14% (1/7)\nremote: Resolving deltas:  28% (2/7)\nremote: Resolving deltas:  42% (3/7)\nremote: Resolving deltas:  57% (4/7)\nremote: Resolving deltas:  71% (5/7)\nremote: Resolving deltas:  85% (6/7)\nremote: Resolving deltas: 100% (7/7)\nremote: Resolving deltas: 100% (7/7), completed with 7 local objects.\nerror: failed to push some refs to 'git@github.com:quora/qcore.git'\n[May 12 12:14 AM remote._get_push_info] Error lines received while fetching: error: failed to push some refs to 'git@github.com:quora/qcore.git'\nPush flags:  1040\nPush summary: [remote rejected] (cannot lock ref 'refs/heads/master': is at cf2cc0c147d8215ec87d3ddaf32f0b2c58630423 but expected fdda486ad43a6e6b5dc5f2795ce27124e0686752)\n\nRemote repo rejected your commit.\n\n\nThis is happening in git version 2.17.0\n\nI've tried searching stack overflow and the git mailing list but the answers aren't recent enough or don’t seem to be permanent fixes.\nHow do I fix this issue?"},{"id":"347436","messageId":"20180512084523.GA28279@sigill.intra.peff.net","threadId":"48469","inReplyTo":"27C6F6E9-2F80-48A6-B551-4AE9957C98A5@icloud.com","subject":"Re: Bug report for git push","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-05-12T08:45:23Z","receivedAt":"2018-05-12T08:45:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 11, 2018 at 09:44:54PM -0400, Surenkumar Nihalani wrote:\n\n> Push summary: [remote rejected] (cannot lock ref 'refs/heads/master': is at cf2cc0c147d8215ec87d3ddaf32f0b2c58630423 but expected fdda486ad43a6e6b5dc5f2795ce27124e0686752)\n\nThis generally indicates that somebody was pushing at the same time as\nyou, and you lost the race. The push conversation works basically like\nthis:\n\n 1. server advertise master at some sha1 (like fdda486ad)\n\n 2. client checks that moving from fdda486ad to whatever the new value is\n    (let's say 1234abcd) matches its criteria (e.g., not a fast-forward)\n    and prepares a pack with the appropriate objects\n\n 3. client tells server \"update master from fdda486ad to 1234abcd\"\n\n 4. server locks master and then under lock checks that it's still at\n    fdda486ad. In this case it's not, so it aborts the lock. This is\n    likely due to somebody else pushing in the interim.\n\nIf you push again at this point, the client will notice in step that\nit's not a fast-forward and give you the \"somebody else has pushed, you\nneed to pull first\" error message.\n\nThe only difference here is that because of the timing (i.e., somebody\npushing at the exact same time as you), only the server's locking\noperation noticed the conflict. But the fix is the same (pull their\nwork, then push).\n\n-Peff\n"}]}