Skip to content

Instantly share code, notes, and snippets.

@polupraneeth
Forked from 0xjac/private_fork.md
Last active January 29, 2020 22:46
Show Gist options
  • Save polupraneeth/b359a24967a05b87c5e1875e018df8ea to your computer and use it in GitHub Desktop.
Save polupraneeth/b359a24967a05b87c5e1875e018df8ea to your computer and use it in GitHub Desktop.
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

    git clone --bare [email protected]:usi-systems/easytrace.git
  2. Create a new private repository on Github and name it easytrace.

    If you are unable to create a private repo, you can request unlimited private repos as a studant by getting the student pack from Github.

  3. Mirror-push your bare clone to your new easytrace repository.

    Replace <your_username> with your actual Github username in the url below.

    cd easytrace.git
    git push --mirror [email protected]:<your_username>/easytrace.git
  4. Remove the temporary local repository you created in step 1.

    cd ..
    rm -rf easytrace.git
  5. You can now clone your easytrace repository on your machine (in my case in the code folder).

    cd ~/code
    git clone [email protected]:<your_username>/easytrace.git
  6. To pull new updates from the public repo.

    cd private-repo
    git remote add public [email protected]:usi-systems/easytrace.git
    git pull public master # Creates a merge commit
    git push origin master

    Awesome, your private repo now has the latest code from the public repo plus your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment