Github 组织“远程:未找到存储库。” 通过 Https 克隆

Mat*_*ggs 6 git github

一段时间以来,我一直以个人身份使用 Github。现在我需要创建一个组织并在该组织中启动一个回购。

因此,我以我自己的身份登录 Github,创建了新组织。然后我创建了一个回购。查看 repo 我可以看到我是 repo 的贡献者。回购是并且需要是私有的。

当我尝试克隆时:

$ 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
Run Code Online (Sandbox Code Playgroud)

本地 git 会记住我的凭据,例如,如果我的个人 Github 存储库中有一个私有存储库,则 git clone https://github.com/Webern/my-personal-private-repo.git无需请求我重新输入我的 Github 用户名和密码即可工作。

组织怎么了?如何克隆我新成立的组织私有仓库?

Mat*_*ggs 7

最终,我认为这个问题与我的 Mac 钥匙串中的凭据缓存有关。解决问题所采取的步骤的完整列表如下,但我相信关键步骤是使用 Mac OS 的 Keychain Access 实用程序删除所有 Github 凭据。

将用户名和密码添加到 https URL 确实有效,但对于永久使用似乎是个坏主意。

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
Run Code Online (Sandbox Code Playgroud)

将 URL 改回使其不包含我的用户名和密码后,我仍然无法连接到遥控器。

MyMac:my-repo mjb$ git push origin --all
remote: Repository not found.
Run Code Online (Sandbox Code Playgroud)

现在我用 git config 做了一堆乱七八糟的事情,我认为这是不必要的。

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
Run Code Online (Sandbox Code Playgroud)

现在我在我的 Mac 上进入实用程序 -> 钥匙串访问 我删除了与 Github 相关的所有凭据
奇怪的是它们是正确的,当我再次输入我的用户名和密码时,我输入了相同的用户名和密码。

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)
Run Code Online (Sandbox Code Playgroud)

成功。