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

什么好主意吗?


当前回答

都经历过同样的问题。几年来一切都很正常,然后突然出现了这个错误。

问题是,我在用户的github SSH密钥(我总是用来访问有问题的回购)之前向我的SSH代理添加了另一个回购的部署密钥。SSH代理首先尝试了另一个回购的部署键,而GitHub出于一些完全无法解释的原因说

ERROR: Repository not found.

一旦我从SSH代理中删除了部署键,一切就恢复正常了。

其他回答

如上Alex所说,更改.git/config文件的内容会有所帮助。我也遇到了同样的问题,我想这是因为我更改了我的Github用户名。无法使用更改更新本地文件。所以当你改变你的用户名时,你可能会考虑跑步

Git远程添加原点your_ssh_link_from_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

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

在使用MacBook Pro时遇到了同样的问题。

当我尝试克隆一个存储库时,我得到以下错误:

git clone https://github.com/mytech/mytech_frontend.git

Cloning into 'mytech_frontend'...
remote: Repository not found.
fatal: repository 'https://github.com/mytech/mytech_frontend.git/' not found

以下是我的解决方法:

问题是我已经在我的电脑上设置了我的个人GitHub帐户,我试图克隆的存储库是个人的私人存储库(而不是团队帐户)。

我所要做的就是通过进入项目设置,将我的个人Github帐户添加为存储库中的合作者之一。之后我就可以克隆这个项目了。

这是如何解决我的问题

#check current github account
ssh -T git@github.com

#ensure the correct ssh key used with github
ssh-agent -s
ssh-add ~/.ssh/YOUR-GITHUB-KEY

#re-add the origin
git remote add origin git@github.com:YOUR-USER/YOUR-REPO.GIT
git push -u origin master

我在一台MAC上遇到了同样的问题,试图从我以前连接到的一个私人回购中提取。

我通过在回购url中包含我的用户名来解决这个问题:

git remote set-url origin https://<YOUR_USER_NAME_HERE>@github.com/<YOUR_USER_NAME_HERE>/<REPO>.git

然后我从回购中提取了数据。

对于一个你想克隆的新回购:

git clone https://<YOUR_USER_NAME_HERE>@github.com/<YOUR_USER_NAME_HERE>/<REPO>.git    

它会提示你输入那个账户的密码,然后你就可以去了。