I think there must be an easier way to do this. Right now I find myself following these steps:
On the remote:
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 some shortcut?
Unfortunately almost all steps are necessary, even though locally you can avoid to recreate the repo by cloning it.
Just init the repo and add a 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 reference, so later on you can simply type git push
instead of git push origin master
.
The answer from Gabriele almost worked for me.
Before the git push -u origin master
a git init --bare my_repo
needs to be called in the directory that ssh:://myserver
points to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With