GIT的复杂设置:从Github到Bitbucket,仅从PUSH到Bitbucket

时间:2014-06-20 00:14:48

标签: git github bitbucket

我不是GIT专家所以我需要一些关于这个设置的帮助我正在进行的项目。所以基本上这就是我需要的:

  1. 从Github到Bitbucket创建一个fork,怎么样?这保证git pull始终使用Github主项目的最新更改来更新CORE?
  2. 只允许推送到Bitbuket存储库,这可能吗?怎么样?
  3. 我使用SmartGit作为主客户端,但也有git命令行。

    对此有何帮助?

1 个答案:

答案 0 :(得分:14)

创建空的BitBucket仓库后,您可以

git clone https://github.com/user/yourRepo
cd repo
git remote rename origin upstream
git remote add origin https://yourAccount@bitbucket.org/yourAccount/yourRepo
git push --mirror

然后确保master将从bitbucket repo(upstream作为远程名称引用原始GitHub回购提取)

git checkout master
git branch -u origin/master
git push.default matching

git push将推送到bitbucket repo(origin),但您需要git pull upstream从原始GitHub存储库中提取/更新。

默认情况下,您将使用BitBucket(就像所有其他开发人员克隆新的repo一样),但开发人员可以随时添加对原始GitHub存储库的引用(远程)。