Skip to content

Instantly share code, notes, and snippets.

@cloudcap10
Last active April 9, 2021 00:29
Show Gist options
  • Save cloudcap10/8762084712a357414e1ae0d84d58d96b to your computer and use it in GitHub Desktop.
Save cloudcap10/8762084712a357414e1ae0d84d58d96b to your computer and use it in GitHub Desktop.
## Git Changing a remote's URL
$ git remote -v
> origin git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin git@github.com:USERNAME/REPOSITORY.git (push)
git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
$ git remote -v
# Verify new remote URL
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)
Open Git Bash.
Create a bare clone of the repository.
$ git clone --bare https://github.com/exampleuser/old-repository.git
Mirror-push to the new repository.
$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git
Remove the temporary local repository you created earlier.
$ cd ..
$ rm -rf old-repository.git
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment