Search code examples
gitgithubbitbucketgit-remote

Working with multiple repositories from different servers


I have two repositories: One in github and another on Bitbucket.
I'm confused. Using git Bash how may I select which remote repository I want to work with ? Is there an easy way to switch between them ? ( I already have my project on remote server).

Update

I could 'add' two repositories with the following command:

git add remote Repository_URL  

Now if I do

git remote -v  

It shows me both repositories and its URLs.

Now I need to know how to select one of them to work with.


Solution

  • You specify the remote name in a specific git command. For example, if they were called github and bitbucket:

    git pull github master
    git pull bitbucket master
    
    git fetch bitbucket
    
    git push github master
    

    etc.

    You can also specify a per-branch default remote in your config file if you like.