Skip to content

Instantly share code, notes, and snippets.

@hofnerb
Last active October 16, 2023 05:43
Show Gist options
  • Save hofnerb/5fa4913f5e469825ce37 to your computer and use it in GitHub Desktop.
Save hofnerb/5fa4913f5e469825ce37 to your computer and use it in GitHub Desktop.
git remote set-url

Review and Change Remote URL

git remote -v
# View existing remotes

git remote set-url origin https://github.com/user/repo2.git
# Change the 'origin' remote's URL

git remote -v
# Verify new remote URL

(Source: http://stackoverflow.com/a/19298943/2574238)

Check remote tracking repository

git branch -vv

Push local_branch to remote remote_branch, i.e., to a branch with a different name

## to set the pull
git push -u remote local_branch:remote_branch
## to set the default push
git config push.default upstream

(see http://stackoverflow.com/a/5739015/2574238 and http://stackoverflow.com/a/5740047/2574238)

@olavea
Copy link

olavea commented Apr 30, 2022

😸

@anilarya-spacer
Copy link

Setup SSH once , and run git remote set-url origin <repo URL>. can solve the problem with fewer steps

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