ReynierPM
ReynierPM

Reputation: 18660

Complex setup for GIT: fork from Github to Bitbucket, PUSH to Bitbucket only

I'm not a GIT expert so I need some help on this setup for a project I'm working on. So basically this is what I need:

  1. Create a fork from Github to Bitbucket, how? this guarantees made git pull all the time to mantain CORE updated with latest changes from Github main project?
  2. Allow to PUSH only to Bitbuket repository, is that possible? How?

I'm using SmartGit as main client but also have git command line.

Any help on this?

Upvotes: 10

Views: 4138

Answers (1)

VonC
VonC

Reputation: 1324258

Once you have created an empty BitBucket repo, you can

git clone https://github.com/user/yourRepo
cd repo
git remote rename origin upstream
git remote add origin https://[email protected]/yourAccount/yourRepo
git push --mirror

Then make sure master will pull from the bitbucket repo (upstream being the name of the remote referring to the original GitHub repo)

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

The git push will push to the bitbucket repo (origin), but you need git pull upstream to pull/update from the original GitHub repo.

By default, you will be working with the BitBucket one (like all other developers cloning that new repo), but a developer can add at any moment a reference (remote) to the original GitHub repo.

Upvotes: 14

Related Questions