Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 798
ReynierPM Avatar asked Jun 20 '14 00:06

ReynierPM


1 Answers

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.

like image 152
VonC Avatar answered Oct 31 '22 04:10

VonC