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

Rey*_*rPM 10 git github bitbucket

我不是GIT专家所以我需要一些帮助来完成我正在进行的项目的设置.所以基本上这就是我需要的:

  1. 从Github到Bitbucket创建一个fork,怎么样?这个保证是否git pull一直使用Github主项目的最新变化来更新CORE?
  2. 允许PUSH只到Bitbuket存储库,这可能吗?怎么样?

我使用SmartGit作为主客户端,但也有git命令行.

对此有何帮助?

Von*_*onC 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
Run Code Online (Sandbox Code Playgroud)

然后确保masterbitbucketrepo中拉出(upstream作为远程的名称引用原始的GitHub repo)

git checkout master
git branch -u origin/master
git push.default matching
Run Code Online (Sandbox Code Playgroud)

git push会推到位桶回购(origin),但你需要git pull upstream从最初的GitHub库拉/更新.

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

  • @psk谢谢.我已经相应地编辑了答案. (2认同)