git origin url code example

Example 1: get git remote url

git config --get remote.origin.url

Example 2: git view remote url

git remote show origin

Example 3: git check upstream url

git remote show origin

Example 4: check git url

# Check existing git url:
git remote -v

Example 5: see git origin

git remote -v

Example 6: git remote chage url

git remote -v
# View existing remotes
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

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

git remote -v
# Verify new remote URL
# origin  https://github.com/user/repo2.git (fetch)
# origin  https://github.com/user/repo2.git (push)