我有一个非常奇怪的问题与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 pull https://myusername:mypassword@github.com/path_to/myRepo.git

其他回答

这个答案是IntelliJ产品(如IDEA / WebStorm / PHPStorm)在使用组织时所特有的。

我有这个问题与WebStorm时,试图推动到一个存储库的一部分 一个组织,同时推送到我正常范围内的存储库 私人账户有效。 此外,用IntelliJ IDEA推送到我的组织存储库也起作用了

所以我认为这可能只是与两个ide之间的设置不同有关,我发现我在WebStorm中启用了“使用凭据助手”复选框,而在IDEA中禁用了。

禁用凭据助手使其工作!!

另外,一定要检查是否安装了桌面客户端。我仔细检查了一切,我的权限,SSH,但原来我在客户端列出的回购覆盖了我通过终端输入的。

SSH访问检查方法如下:

ssh -T git@github.com

这个问题是因为我没有在存储库中添加SSH上的人响应,阅读更多关于SSH link-1, link-2的信息。

一个问题,这可能是显而易见的一些,我没有看到这里提到,可能是你有ssh密钥访问,但你正试图通过https连接你的本地回购到远程。

如果是这种情况,那么下面的命令应该可以解决这个问题:

$ git remote -v
origin  https://github.com/private-repo.git (fetch)
origin  https://github.com/private-repo.git (push)
$ git remote rm origin
$ git remote add origin git@github.com:private-repo.git
$ git remote -v
origin  git@github.com:private-repo.git (fetch)
origin  git@github.com:private-repo.git (push)

请注意,上述工作的前提是: 您当前的远程名为origin,并且您已经拥有 生成SSH密钥连接到您的github帐户 你已经有一个SSH密钥与你的github帐户相关联(并在本地连接) 你有正确的权限(读/写)设置在github为这个回购的设置。

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