📘
Git-Help
Git Cheatsheet
  • A Simple Git Help
  • Basics
  • Git Branching
  • Pull Request
  • Submodules
  • Commands / Actions
    • Commit changes to other branch
    • git log
    • git status
    • git init
    • Amend a commit
    • Reset a file or full
    • Undo git add
    • Get remote repo url
    • Add or Set Remote URL
    • delete branch
  • Credits & Other
    • Other good links
    • Credits
Powered by GitBook
On this page

Was this helpful?

  1. Commands / Actions

Add or Set Remote URL

To add a remote repository to a existing git project or to update the existing rep

PreviousGet remote repo urlNextdelete branch

Last updated 3 years ago

Was this helpful?

Note:- You can create a local git repo with "git init" command. Then you wont have the remote repository set. In that case you can add a remote repository with the following command.

git remote add origin https://github.com/USERNAME/REPOSITORY.git
  -- or --
git remote add origin git@github.com:USERNAME/REPOSITORY.git

If you want to change the url of an existing remote repository:

git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
  -- or --
git remote set-url origin git@github.com:USERNAME/REPOSITORY.git

To find remote repo

git remote -v

https://stackoverflow.com/questions/42830557/git-remote-add-origin-vs-remote-set-url-origin