set remote repository git code example

Example 1: git update remote origin

git remote set-url origin new.git.url/here

Example 2: change remote url git

git remote set-url origin https://hostname/USERNAME/REPOSITORY.git

Example 3: git change remote

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

Example 4: git add remote

$ git remote add origin https://github.com/user/repo.git
# Set a new remote

$ git remote -v
# Verify new remote
> origin  https://github.com/user/repo.git (fetch)
> origin  https://github.com/user/repo.git (push)

Example 5: git set remote

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

Example 6: get git remote url

git config --get remote.origin.url