0

What happens if two git pull command are run simultaneously in the same directory?

3

git does file locking to prevent corrupting the repository. You may get messages like

error: cannot lock ref 'refs/remotes/origin/develop': is at 2cfbc5fed0c5d461740708db3f0e21e5a81b87f9 but expected 36c438af7c374e5d131240f9817dabb27d2e0a2c
From github.com:myrepository
 ! 36c438a..2cfbc5f  develop    -> origin/develop  (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/master': is at b9a3f6cf9dafc30df38542e5e51ae4842c50814d but expected 5e6174b3c7071c840effeda6c708d6aef36f7c6a
 ! 5e6174b..b9a3f6c  master     -> origin/master  (unable to update local ref)

from the git processes that fail to get the lock. That is all.

If the two git pull processes are slightly out of sync with each other, the effect will be the same as running the command twice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.