Reset the remote URL :
Git provides the ' git remote set-url ' command to reset the remote URI.The other way to reset the remote URI is first delete the current URI and then again use git remote add command. Following is the syntax of change the remote repository URI using git remote set-uri:
$ git remote set-url repoName newURI
The git remote rename command takes two arguments:
- An existing remote name, for example, 'origin'
- A new URI of remote repository, for example, 'git@github.com:ROGER/OTHERREPOSITORY.git'
For example :
First we will check the old remote repository URI which we will reset to new repository URI .Here we will clone the repository using the HTTPS.
$ git remote -v
# View existing remotes
# origin https://github.com/OWNER/MyRepository.git (fetch)
# origin https://github.com/OWNER/MyRepository.git (push)
$ git remote set-url origin git@github.com:ROGER/OTHERREPOSITORY.git
# Change remote URI
$ git remote -v
# Verify remote's new name
# destination https://github.com/ROGER/OTHERREPOSITORY.git (fetch)
# destination https://github.com/ROGER/OTHERREPOSITORY.git (push)
0 Comment(s)