简体   繁体   English

Github推送到私人仓库,未发现错误

[英]Github pushing to a private repo, not found error

I can't exactly find the answer to my issue, or I'm just missing something. 我无法完全找到问题的答案,或者我只是缺少一些东西。

I created an empty private repo on GitHub. 我在GitHub上创建了一个空的私人仓库。 I have an existing Git project on my local machine. 我的本地计算机上已有一个Git项目。

I would like to push the local Git project to the existing private repo, but receiving the "Repository not found" error. 我想将本地Git项目推送到现有的私有仓库中,但是收到“找不到存储库”错误。

Used the following commands provided by GitHub: 使用了GitHub提供的以下命令:

git remote add origin https://github.com/url.git
git push -u origin master

If I use the Github GUI application, which lets me login, I can push an existing local Git project to my private Github repo no problem. 如果我使用允许我登录的Github GUI应用程序,则可以毫无问题地将现有的本地Git项目推送到我的私有Github存储库中。

I would prefer to push from the Terminal however. 但是,我希望从终端推送。

Found the issue. 找到了问题。 I had a different GitHub account saved in my Keychain. 我的钥匙串中保存了另一个GitHub帐户。 When trying to push to origin, I wasn't prompted for a new username/password, because it kept trying to use whatever was saved in my Keychain. 尝试推送至原始位置时,没有提示我输入新的用户名/密码,因为它一直尝试使用保存在我的钥匙串中的任何内容。

Here are instructions on fixing that: https://help.github.com/articles/updating-credentials-from-the-osx-keychain/ 以下是修复此问题的说明: https : //help.github.com/articles/updating-credentials-from-the-osx-keychain/

Also, if you use 2 Step Authentication, you will need to create an Personal Access Token and use that instead of your GitHub password. 同样,如果您使用两步身份验证,则需要创建一个个人访问令牌,并使用它代替您的GitHub密码。 Instructions on creating a token are here: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ 有关创建令牌的说明,请参见: https : //help.github.com/articles/creating-a-personal-access-token-for-the-command-line/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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