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
If you're using TortoiseGit then follow the below steps:
TortoiseGit -> Settings
Git -> Remote
origin
URL
text box value to where ever your new remote repository isYour branch and all your local commits will remain intact and you can keep working as you were before.
As seen here,
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
Troubleshooting :
You may encounter these errors when trying to changing a remote. No such remote '[name]'
This error means that the remote you tried to change doesn't exist:
git remote set-url sofake https://github.com/octocat/Spoon-Knife fatal: No such remote 'sofake'
Check that you've correctly typed the remote name.
Reference : https://help.github.com/articles/changing-a-remote-s-url/
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.
check your privilege
in my case i need to check my username
i have two or three repository with seperate credentials.
problem is my permission i have two private git server and repositories
this second account is admin of that new repo and first one is my default user account and i should grant permission to first
In the Git Bash, enter the command:
git remote set-url origin https://NewRepoLink.git
Enter the Credentials
Done