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

什么好主意吗?


当前回答

我在一台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    

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

其他回答

如果您确定已经拥有对这个存储库的SSH访问权限。

Do

git clone https://myusername@github.com/path_to/myRepo.git

我也遇到过同样的问题,是私人回购。

做以下几点:

移除远端原点

git remote rm origin

重新添加原点,但与您的用户名和PWD与写权限在这个PVT回购

git remote add origin  https://USERNAME:PASSWORD@github.com/username/reponame.git

我得到了同样的错误,因为我改变了我的github用户名,然后我这样做:

git remote -v

然后:

git remote set-url newname newurl 
git push -u origin master

这次我能够推送到存储库。 我希望这能有所帮助。

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

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

Phpstorm将输出以下内容:

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

而不是

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

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

我也有同样的问题。

我解决了把我的gitlab用户名前缀到gitlab.com url的问题,就像这样: 之前: https://gitlab.com/my_gitlab_user/myrepo.git 后: https://my_gitlab_user@gitlab.com/my_gitlab_user/myrepo.git 在这种情况下,将再次要求凭据,这就完成了!