简体   繁体   中英

Github Organization "remote: Repository not found." via Https Clone

I have been using Github as an individual for some time. Now I need to create an organization and start a repo in the organization.

So, logged in to Github as myself, I created the new organization. I then created a repo. Viewing the repo I can see that I am a contributor to the repo. The repo is, and needs to be, private.

When I try to clone:

$ git clone https://github.com/my-organization/my-repo.git my-repo-folder
Cloning into 'my-repo-folder'...
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found

Locally git is remembering my credentials, so for example, if I have a repository in my personal Github repos, which is private, then git clone https://github.com/Webern/my-personal-private-repo.git works without requesting that I re-enter my Github username and password.

What is going on with the organization? How do I clone my newly-formed organizations private repo?

Ultimately I believe the problem had something to do with the caching of credentials in my Mac's Keychain. The complete list of steps taken to fix the problem is below, but I believe the crucial step was to delete all Github credentials using Mac OS's Keychain Access utility.

Adding the username and password to the https URL does work, but seems like a bad idea for permanent use.

MyMac:~ mjb$ git clone https://MyGithubUsername:MyGithubPassword@github.com/my-organization/my-repo.git
MyMac:~ mjb$ cd my-repo
MyMac:my-repo mjb$ git remote set-url origin https://github.com/my-organization/my-repo.git

After changing the URL back so that it does not contain my username and password, I still could not connect to the remote.

MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.

Now I did a bunch of flailing with git config, which I suppose was unnecessary.

MyMac:my-repo mjb$ git config --global user.name MyGithubUsername

MyMac:my-repo mjb$ git --version
git version 2.15.0

MyMac:my-repo mjb$ git config --global credential.helper manager
MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found
MyMac:my-repo mjb$ git config --global --unset credential.helper
MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found

Now I went on my Mac to Utilities -> Keychain Access I deleted all credentials relating to Github
What is strange about this is that they were correct, and when I entered my username and password again I was entering the same username and password.

MyMac:my-repo mjb$ git push origin --all
Username for 'https://github.com': MyGithubUsername
Password for 'https://MyGithubUsername@github.com': MyGithubPassword
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 651 bytes | 651.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)

Success.

In case you have access tokens enabled for your GitHub account, make sure to tick the entire repo setting under Developer settings -> Personal access tokens as shown here (Step 7). Enabling all suboptions in the repo category is not enough.

That did the trick for me. No need to reset your credentials anywhere.

I had only the public_repo option enabled and that was sufficient to clone and push to my public repos but not to private repos in the organization where I even had an admin role.

The error is quite cryptic and misleading, especially when you are sure to have all the access rights.

My suspects

  • you probably have and extra layer of security in your Private repo, confirm that you either don't have a two-way authentication or something else. That will make hit flag you and error or wrong login credentials anytime you try to push.

But in your case, you were trying to clone, so ensure that you're using the same credentials(email most especially) that you're using in the organization repo and your personal repo, it might possible be a permission thing. Git might assume the credentials you entered doesn't have the right to access the repo.

I have been using Github as an individual for some time. Now I need to create an organization and start a repo in the organization.

So, logged in to Github as myself, I created the new organization. I then created a repo. Viewing the repo I can see that I am a contributor to the repo. The repo is, and needs to be, private.

When I try to clone:

$ git clone https://github.com/my-organization/my-repo.git my-repo-folder
Cloning into 'my-repo-folder'...
remote: Repository not found.
fatal: repository 'https://github.com/my-organization/my-repo.git/' not found

Locally git is remembering my credentials, so for example, if I have a repository in my personal Github repos, which is private, then git clone https://github.com/Webern/my-personal-private-repo.git works without requesting that I re-enter my Github username and password.

What is going on with the organization? How do I clone my newly-formed organizations private repo?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM