Repository not found, but I can't add it either
Repository not found, but I can't add it either
After changing to 2 factory authentication, I get the following error when I try to pull/push to/from a remote branch such as
git pull origin master
:
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-project.git/' not found
However, when I try to add the repository
git remote add origin https://github.com/my-organization/my-project.git
I get an error
fatal: remote origin already exists.
I follow this document to resolve invalid username or password error.
Now, How can I resolve this repository error?
Update:
I try to start out on the repository with
git clone https://github.com/my-organization/my-project.git
And I get the same error:
Cloning into 'my-project'...
git: 'credential-netrc' is not a git command. See 'git --help'. <-- don't know how this comes up
Username for 'https://github.com': my-username
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-project.git/' not found
Did you put this url github.com/<organization>/<project>.git, or you changed it with your own informations?
– WebD
yesterday
How to get rid of the trailing slash?
– vic
yesterday
1 Answer
1
The error is telling you that it has a remote URL, but it cannot find a repository there. When you try to add another one, Git correctly tells you that you already have a remote for origin.
To change the URL, use git remote set-url origin <url>
. You probably need to remove that trailing slash, but to be sure copy the URL directly from Github's "Clone or Download" button.
git remote set-url origin <url>
If you're using 2-factor auth with https
URLs, you need to use your personal access token instead of your password. Or save a lot of headaches and use ssh.
https
After running "git remote set-url origin github.com/my-organization/my-project.git", I get "git pull origin master" and get the same error. - repository ... not found. There is a backward slash at the end. Is the source of the problem?
– vic
yesterday
I do use a PAT generated on the github site. Otherwise, I won't be able to go this far.
– vic
yesterday
@vic It's just a normal https URL. There should be no backslashes. For example,
git remote set-url origin https://github.com/evalEmpire/perl5i.git
– Schwern
yesterday
git remote set-url origin https://github.com/evalEmpire/perl5i.git
Thanks for sharing your thought. I try to find a way to remove the last backward slash.
– vic
yesterday
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please give an example command that gives the error. It looks like you have an erroneous trailing slash on the URL.
– Code-Apprentice
yesterday