If you are using gitlab as git-server, try this:
Push to create a new project
Introduced in GitLab 10.5.
When you create a new repository locally, instead of going to GitLab to manually create a new project and then clone the repo locally, you can directly push it to GitLab to create the new project, all without leaving your terminal. If you have access rights to the associated namespace, GitLab will automatically create a new project under that GitLab namespace with its visibility set to Private by default (you can later change it in the project’s settings).
This can be done by using either SSH or HTTPS:
## Git push using SSH
git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
## Git push using HTTPS
git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
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
and scp -r my_project.git user@git.example.com:/srv/git
. You can refer to the official doc for more.