Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push from one repo to another - Git

I have a repo on my local computer. I want to develop and make changes in a branch on my local repo and then push these changes for testing to a repo on a server that I can ssh into. How do I do this? I have never pushed/pulled from the local to the server, only pulled down through SSH from my bitbucket account to either my local computer or remote server.

Thanks, Mo

like image 291
moesef Avatar asked May 20 '13 19:05

moesef


2 Answers

You can create a repo on the server by logging in to it, and do a git init --bare.

Then on you local computer you

git remote add serverrepo <url to server repo>

Now you can push and pull to the serverrepo, and to origin (bitbucket?).

You can push your branch to just the serverrepo if you wish:

git push -u serverrepo branchname

If you need to "publish" the repo on the server somehow, you can follow this guide.

like image 192
Klas Mellbourn Avatar answered Sep 25 '22 02:09

Klas Mellbourn


If you want to avoid the command line and are using Atlassian SourceTree do Repository->Add Remote on the source repository and then you can push your changes to the destination.

like image 39
mhenry1384 Avatar answered Sep 24 '22 02:09

mhenry1384