我有一个非常奇怪的问题与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
什么好主意吗?
我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
步骤1:
从HTTPS复制链接
步骤2:
在本地存储库中
git remote rm origin
步骤3:
在复制的url中将github.com替换为username.password@github.com
步骤4:
git remote add origin url
其他回答
如果你的repo之前工作正常,突然弹出这个错误,最有可能的原因是你的git被认证为其他用户,没有访问存储库的权限。因此,为了进行推送,您所需要做的就是在git命令中指定正确的用户名和密码。所以,一个github回购的推命令看起来像:
git push https://youruser:password@github.com/user/reponame.git
用户名和密码需要进行url转义,因此@应该被%40取代,等等。
我也遇到过类似的问题。错误的凭据缓存在OS X的密钥链中。
查看:https://help.github.com/articles/updating-credentials-from-the-osx-keychain
所以对我来说,我的密码有一个'(勾),PhpStorm在发送git推送之前删除了这个字符:
在这个例子中,我的密码是_pa ' ' ssword_
Phpstorm将输出以下内容:
https://_username_:_password_@github.com/_username_/repo.git
而不是
https://_username_ _pa“ssword_@github.com/_username_/repo.git
将密码更改为不使用'字符的密码。工作! !
我得到了同样的错误,因为我改变了我的github用户名,然后我这样做:
git remote -v
然后:
git remote set-url newname newurl
git push -u origin master
这次我能够推送到存储库。 我希望这能有所帮助。
我得到了同样的错误
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
这一次我可以推到存储库。