Server: Atlassian Bitbucket v4.14.3 (aka Stash) Client: git version 2.17.1 (on Linux Ubuntu 18LTS)
What is the best way to detect whether the GIT server is alive and providing service?
Use case1: On a daily basis, the Bitbucket server goes down to perform a full backup. During the backup period, it doesn't respond to requests, and any 'git clone and git push' command fails (we issue those commands from scripts). Before issuing a 'clone' or a 'push' , I'd like to know whether the GIT server is in production to avoid an error.
Use case2: Once in a while, the Bitbucket server is brought down (for upgrade, some maintenance, etc). Similar as the situation above, I'd like to know whether it is in production before issuing a 'clone' or ' push' to avoid an error.
Does Bitbucket server have some API to check that? Does the git client have a command to check that? (I'd prefer this option , to avoid dependence on the server)
I've tried 'git ls-remote -h ssh:/reponame --exit-code' , but I'd like to know whether there is a better option where I don't have to provide a repository name.