我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:

git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

我添加了遥控器:

git remote add origin git@github.com:account-name/repo-name.git

什么好主意吗?


当前回答

为了解决这个问题(在Linux上),我只需要运行这个:

git config --global --unset credential.helper

其他回答

我也遇到过类似的问题。错误的凭据缓存在OS X的密钥链中。

查看:https://help.github.com/articles/updating-credentials-from-the-osx-keychain

eval "$(ssh-agent -s)"

这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。

检查是否具有读写权限。

Git错误消息具有误导性。我也遇到过类似的问题。我被添加到一个现有的项目中。我克隆了它并提交了一个本地更改。我去推,得到了ERROR: Repository not found。错误消息。

将我添加到项目的人给了我对存储库的只读访问权。他们做出了改变,我得以推动。

首先在命令行上创建一个新的存储库,命名为adim .git

在命令行上创建一个新的存储库

触摸README.md git init git添加README.md Git commit -m "第一次提交" git远程添加origin https://github.com/your_name/Ademo.git Git push -u origin master

从命令行推送现有存储库

git远程添加origin https://github.com/your_name/Ademo.git Git push -u origin master

所以对我来说,我的密码有一个'(勾),PhpStorm在发送git推送之前删除了这个字符:

在这个例子中,我的密码是_pa ' ' ssword_

Phpstorm将输出以下内容:

https://_username_:_password_@github.com/_username_/repo.git

而不是

https://_username_ _pa“ssword_@github.com/_username_/repo.git

将密码更改为不使用'字符的密码。工作! !