我有一个非常奇怪的问题与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

什么好主意吗?


当前回答

Normally it happens because the project is private and you have not rights to write it. I had the same "problem" a few times, and it was for that reason. If the project it is yours, just create a private and a public key following this link: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and add them to the "SSH and Key" section on gitHub, then you will be able to push to the repo. In the other hand if the project it is not your, ask the owner to give you the rights for it.

其他回答

这也可能发生,因为GitHub本身宕机了。一定要检查stat.github.com,看看问题是否在他们那边。

2018年10月22日,你有好几个小时都无法推送到GitHub。

我得到了同样的错误

ERROR: Repository not found.   
fatal: The remote end hung up unexpectedly

我在Github上创建了存储库,并在本地克隆了它。

我可以通过打开.git/config并删除[remote "origin"]部分来解决。

[remote "origin"]   
   url = git@github.com:alexagui/my_project.git  
   fetch = +refs/heads/*:refs/remotes/origin/*

然后我运行以下程序(再次)

git remote add origin git@github.com:alexagui/my_project.git  
git push -u origin master

这一次我可以推到存储库。

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

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

这对我来说很管用:

1. 的遥控器

$ git remote rm origin
$ git remote add origin git@github.com:<USER>/<REPO>.git

如果您的SSH密钥已经在另一个github代表上使用,您可以生成一个新密钥。

2. 生成新的SSH密钥

$ ssh-keygen -t rsa -b 4096 -C "web@github.com"

3.在SSH代理级别添加密钥

$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa_github

4. 将新密钥添加到Github回购。

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

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

Phpstorm将输出以下内容:

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

而不是

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

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