我在使用 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文件夹,然后使用记事本打开config文件并检查是否在[remote "origin"]下有指向您的github仓库的链接。如果与您在github上的仓库不同,请编辑它或者按照config文件中的名称创建一个新的仓库。
如果您使用私有存储库,请检查您的连接用户,它必须具有使用存储库的权限。
我也遇到了同样的问题,我的问题在于误解了我必须先在 Github 上创建空仓库,然后再将代码推送到仓库。唉!我把这里包括在内,以便其他人不会犯同样的错误。
在处理 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
这是我解决问题的方法:
首先,确保你能够以以下身份之一访问存储库:
- 存储库所在组织的成员
- 存储库的合作者git clone https://github.com/path_to/myRepo.git
git clone https://myusername:'personal-access-token'@github.com/path_to/myRepo.git
例子:
git clone https://promisepreston:'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'@github.com/promisepreston/my-writings.git
_pa``ssword_
Phpstorm将输出以下内容:
https://_username_:_password_@github.com/_username_/repo.git
https://_username_:_pa``ssword_@github.com/_username_/repo.git
将密码更改为不使用 ` 字符的内容。可行!!!
killall git-credential-cache--daemon
ssh -T git@github.com
,ssh将自动使用您的id_rsa
私钥连接到github。ssh -i ~/.ssh/<some-key> -T git@github.com
应该会导致github用链接到该密钥的帐户向您问候。git config core.sshCommand "ssh -i ~/.ssh/<correct private key here>"
查看git配置git config -l
应该显示该行已正确添加。
git remote add origin git@github.com:account-name/repo-name.git
的方式。它存在于GitHub上,是一个私有仓库。 - Justin[remote "origin"]
部分的URL键中。 - Ahmed Jehanzaib