我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
在执行此操作之前,请确保您拥有对回购的写权限。如果您仍然得到错误,请执行以下操作:
Generate a personal access token from your account from Settings > Developer Settings > Personal Access tokens. Keep the token safe somewhere. Go to your repository and run the following: git remote rm origin Then add a new origin along with your username: git remote add origin https://USERNAME@github.com/REPOSITORY_LINK.git Now when you push the code, a prompt will show up asking for your password or personal access token. Paste the token that we generated in the first step in the field, and we're done.
其他回答
我的解决办法是:
git remote rm origin
git remote add origin https://USERNAME@github.com/username/reponame.git
类似于Emi-C的答案,但没有密码。
我通过Github重新认证解决了这个问题。
如果你有Github CLI,你可以输入gh auth登录
为了解决这个问题(在Linux上),我只需要运行这个:
git config --global --unset credential.helper
我得到了同样的错误
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
这一次我可以推到存储库。
检查是否具有读写权限。
Git错误消息具有误导性。我也遇到过类似的问题。我被添加到一个现有的项目中。我克隆了它并提交了一个本地更改。我去推,得到了ERROR: Repository not found。错误消息。
将我添加到项目的人给了我对存储库的只读访问权。他们做出了改变,我得以推动。