gitconcurrencyls-remote

Is "git ls-remote" a read-only operation?


We are planning to use git ls-remote <repository> [<refs>…] without any additional parameters concurrently to virtually any other Git operation. I'm looking for a confirmation that ls-remote is read-only, so it can't break any other operation.


Solution

  • Yes, it is a read-only operation.

    Nothing in builtin/ls-remote.c suggests any operation modifying the local repo.

    It sets as transport the TRANS_OPT_UPLOADPACK, which is used also in two other git commands (which don't modify the remote repo):

    It is asking the remote repo to send packs, nothing more.