Obs.: Suppose we are using the repository start/yellow as an example.
- Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)
git clone --bare [email protected]:start/yellow.git
-
Create a new private repository on Github and name it
yellow
. -
Mirror-push your bare clone to your new
start/yellow
repository.
Replace
<your_username>
with your actual Github username in the url below.
cd start/yellow.git
git push --mirror [email protected]:<your_username>/start/yellow.git
- Remove the temporary local repository you created in step 1.
cd ..
rm -rf start/yellow.git
- You can now clone your
start/yellow
repository on your machine.
git clone [email protected]:<your_username>/start/yellow.git
- If you want, add the original repo as remote to fetch (potential) future changes. Make sure you also disable push on the remote (as you are not allowed to push to it anyway).
git remote add upstream [email protected]:start/yellow.git
git remote set-url --push upstream DISABLE
You can list all your remotes with git remote -v
. You should see:
origin [email protected]:<your_username>/start/yellow.git (fetch)
origin [email protected]:<your_username>/start/yellow.git (push)
upstream [email protected]:start/yellow.git (fetch)
upstream DISABLE (push)
When you push, do so on
origin
withgit push origin
.When you want to pull changes from
upstream
you can just fetch the remote and rebase on top of your work.
git fetch upstream
git rebase upstream/master
And solve the conflicts if any
https://help.github.com/articles/duplicating-a-repository https://gist.github.com/0xjac/85097472043b697ab57ba1b1c7530274