git "ping": check if remote repository exists
I think the git ls-remote
command is pretty much made for that purpose.
If you use --exit-code
argument you can skip sending output to null
. It will return something only in case of error.
Also, you can use -h
argument to show only heads references.
git ls-remote --exit-code -h "$REPO_URL"
You can narrow output by using something like git ls-remote "$REPO_URL" HEAD