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

什么好主意吗?


当前回答

首先在命令行上创建一个新的存储库,命名为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

其他回答

对我来说,这些回答都没用。 我只是忘记在远程(github.com)上创建回购。所以我在网上创建了我的回购,用同样的名字,然后重新做

所以,这是整个故事:

git init ...
git add ...
git commit ...
git remote add origin git@github.com:<myName>/<myRepo>.git
git push -u origin main

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

这里你需要在github.com上添加你的回购,使用相同的“myRepo”名称

git push -u origin main 

我也有同样的问题。我的问题是误解,我必须先在github上创建空的回购,然后再推到它。哎!包括这个给那些没意识到的人。

使用Ubuntu时,我总是需要使用SSH而不是HTTPS添加远程

git remote add origin git@github.com:username/project.git

而不是

git remote add origin https://github.com/username/project.git

检查是否具有读写权限。

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

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

如果你在Windows上使用Git,试着清除你的凭证:

找到“凭据管理器”(应该在控制面板中) 删除所有与GitHub相关的凭证