I have been trying to figure this one out but I am having a hard time doing so. I am currently working on an open source project that requires me to allow a user to push to remote repository without it already existing there. I want to avoid manually logging in to a server and running git init
or git init --bare
.
For obvious reasons, I get the following error when trying to push my local repository to a path that doesn't point to an existing repository on the remote server:
fatal: '/var/repositories/myrepo' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
But I would like to be able to run for example the following command:
git push origin master
And have that create /myrepo
in /var/repositories
if it does not yet exist. How would I be able to accomplish this? I would assume it is some kind of (global) git config setting you would probably set on the remote server, or otherwise a (repository specific) git config locally, but I couldn't figure it out.
Any help would be much appreciated!
Thanks!