I'm trying to build an easy way for me to create & push repositories to my own server. Currently, I have to create a --bare
repository on my server first before I can push to it.
However, I'd like to be able to dod something like this
git remote add origin https://[email protected]/user/new-repo.git
git push -u origin master
and then on the server, if new-repo.git
doesn't exist under user
on my server, it'll create it and continues to receive objects normally.
So, how can that be achieved on the git server?
If you are using gitlab as git-server, try this:
If you are not using gitlab, I suggest you give it try.
You can deploy a
gitlab-ce
docker container on your ubuntu, it's pretty easy.PS: I think gitlab do the automatic repo creating by hacking the ssh. So you can do this by just combine:
git clone --bare my_project my_project.git
cp -Rf my_project/.git my_project.git
andscp -r my_project.git [email protected]:/srv/git
. You can refer to the official doc for more.