If you do a clone of a git working copy (repository with a working tree) change some files, commit and try to push you'll get a message:
remote: error: refusing to update checked out branch: refs/heads/master
...
! [remote rejected] master -> master (branch is currently checked out)
That's understandable and wanted behavior to me.
I would like to prevent accidentally cloning a working copy of a repository.
How to prevent git clone from cloning working copies instead of remote bare repositories and signal an error in case of an attempt to clone a working copy?
Is there any command line switch that causes git clone non zero exit status in case of an attempt to clone working copy instead of a bare remote repository?
If not then how to check a repository location (url, or path to dir) if it contains a bare repository so I can test that in bash before cloning.
Please note that a working copy of a repository does not necessarily mean it is local because it can be shared by remote as well.
In my case git clone should be allowed only to work with with git bare repositories and signal an error if used to clone working copy.