How can I setup my .git/config to be able to push to / pull from multiple remote repositories?

Ok, I have three different computers that I work from and right now their configurations are all different so I have to push/pull a certain on each and its very bothersome. What I want to do is have ONE config file that I can use for all three that will allow me to do the following:

git push unfuddle
git pull heroku
git push unfuddle
git pull heroku

And I’m new to git, so I know that maybe I need heroku master or ‘heroku origin` or somethign?

  • Removing sensitive data from Git. “fatal: ambiguous argument 'rm'”
  • Add old commits to Github contribution history with Heroku Github Integration
  • Understanding Git and how to use EGit (git eclipse plugin)
  • GitLab postfix configuration mail not sending
  • cant configure dataSource and delegate
  • In git, what is the difference between long and short hashes?
  • Here is what my config file looks like right now:

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@heroku.com:HEROKU-APP.git
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    [remote "unfuddle"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@UNFUDDLE-APP.unfuddle.com:UNFUDDLE-APP/UNFUDDLE-APP.git
    

    Obviously the git urls were changed to protect the innocent. What should I change so that I can easily push and pull to/from both of these repos?

  • Highlighting un-commited code in vim for git
  • Connection error with private repository using GitVersion as a build step in TeamCity
  • Ignoring all files in a directory except one in GIT using negate prefix
  • Why should I put files inside .idea folder under version control?
  • How do I prevent git on Cygwin to set core.filemode=true
  • Windows command line GIT password prompt
  • One Solution collect form web for “How can I setup my .git/config to be able to push to / pull from multiple remote repositories?”

    First of all, there are three levels of config files:

    • config local to your current repo
    • config local to your current user (home directory)
    • config local to your system

    You can define as many remote repo addresses you want, and you can do it at the user level, provided you synchronize that config file from destop to destop

    git remote add origin1 git+ssh://remote.location/git/repository1.git
    git remote add origin2 git+ssh://remote.location/git/repository2.git
    git remote add origin3 git+ssh://remote.location/git/repository3.git
    

    If those commands add the remote addresses only in your current repo config file, you can manually move those to your current user config file.

    But on each repo, you need to define your remote tracking branch for the right repo:

    git branch --set-upstream master origin1/master
    

    (from Git1.7.0, quicker than the two git config branch you had to do before)

    So if you have the right synchronization mechanism (like dropbox for instance) for your user config file, you are all set.

    Git Baby is a git and github fan, let's start git clone.