我如何将Git与多个远程存储库一起使用? [英] How can I use Git with multiple remote repositories?

查看:74
本文介绍了我如何将Git与多个远程存储库一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Heroku进行rails hosting,它使用Git存储库进行部署。我还有一个托管的Git存储库,我用它作为历史/备份目的的主要源代码控制。我想有一个本地文件夹,它有我的应用程序的工作副本,然后能够在需要时将我的更改提交到Heroku存储库或我的托管存储库。

I use currently use Heroku for rails hosting which uses a Git repository for deployment. I also have a hosted Git repository that I use as my main source control for history/backup purposes. I would like to have 1 local folder that has my working copy of my application, then be able to commit my changes to either the Heroku repository, or my hosted repository when needed.

我该怎么做?
(请注意,我熟悉Team System的源代码控制方式,对于Git来说是非常新的)

How do I do this? (note that I am familiar with how Team System does source control and am very new to Git)

推荐答案

添加他们都作为远程:

git remote add origin ssh://myserver.example.com/var/git/myapp.git
git remote add hosted ssh://myotherserver.example.com/var/git/myapp.git

[1] http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository

[2] http://www.kernel.org/pub/software/scm/git/docs/git-remote.html

这篇关于我如何将Git与多个远程存储库一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆