Creating a remote git repository from a local folder

I think there should be an easier way to do this. Now I find myself as follows:

On the remote control:

mkdir my_repo cd my_repo git init --bare 

Then locally:

 mv my_repo old_my_repo git clone ssh://myserver/my_repo mv old_my_repo/* my_repo rmdir old_my_repo cd my_repo git add . git commit -m 'foo' git push origin master 

Is there a shortcut?

+4
source share
1 answer

Unfortunately, almost all steps are necessary, although locally you can avoid re-creating the repo by cloning it.

Just run the repo and add the remote

 cd my_repo git init git remote add origin ssh://myserver/my_repo git add . git commit -m "Initial commit" git push -u origin master 

Note that the -u option will add a tracking link, so later you can just type git push instead of git push origin master .

+16
source

All Articles