Skip to content

Instantly share code, notes, and snippets.

@kiraitachi
Last active March 12, 2019 22:36
Show Gist options
  • Save kiraitachi/64a4a341486557b913def15c19147979 to your computer and use it in GitHub Desktop.
Save kiraitachi/64a4a341486557b913def15c19147979 to your computer and use it in GitHub Desktop.
Sync Forks with Master Repo

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

3. Updating your fork from original repo to keep up with their changes:

git pull upstream master

4. Pushing your Local Repository to your Fork Repository

git push

5 (Optional). If 2FA is enabled when asked for Auth.

https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token

Developer settingsIn the left sidebar, click Developer settings.

Personal access tokensIn the left sidebar, click Personal access tokens.

Generate new token buttonClick Generate new token.

Token description fieldGive your token a descriptive name.

Selecting token scopesSelect the scopes, or permissions, you'd like to grant this token. To use your token to access        repositories from the command line, select repo.

Generate token buttonClick Generate token.

Newly created tokenClick to copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.

Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.

For example, on the command line you would enter the following:

git clone https://github.com/username/repo.git
Username: your_username
Password: your_token

5. Pushing your local Repository Wiki or cloned wiki to your branch

Clone your wiki

git clone https://github.com/username/repo.wiki.git

Access your local cloned wiki

cd /path/to/local/cloned/wiki
git add .
git commit -m "new files"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment