I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved \"origin\" to a NAS and successfully tested cloning it from here.
I would like to
Navigate to the project root of the local repository and check for existing remotes:
git remote -v
If your repository is using SSH you will see something like:
> origin git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin git@github.com:USERNAME/REPOSITORY.git (push)
And if your repository is using HTTPS you will see something like:
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)
Changing the URL is done with git remote set-url
. Depending on the output of git remote -v
, you can change the URL in the following manner:
In case of SSH, you can change the URL from REPOSITORY.git
to NEW_REPOSITORY.git
like:
$ git remote set-url origin git@github.com:USERNAME/NEW_REPOSITORY.git
And in case of HTTPS, you can change the URL from REPOSITORY.git
to NEW_REPOSITORY.git
like:
$ git remote set-url origin https://github.com/USERNAME/NEW_REPOSITORY.git
NOTE: If you've changed your GitHub username, you can follow the same process as above to update the change in the username associated with your repository. You would only have to update the USERNAME
in the git remote set-url
command.