我想把我的电脑仓库推到GitHub.我设置了远程原点
git remote add origin git@github.com:alicht/tweetanuber.git
Run Code Online (Sandbox Code Playgroud)
然后在我尝试推送到GitHub之后
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
我遇到了这个错误:
ssh: connect to host github.com port 22: Operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
如何解决此问题并将本地计算机上的repo推送到GitHub?
小智 29
我也有同样的问题,解决方法是编辑〜/ .ssh / config,将以下行:
Host github.com
Hostname ssh.github.com
Port 443
Run Code Online (Sandbox Code Playgroud)
Gau*_*rav 15
这表明该git
软件无法通过SSH连接到Github:如果您的防火墙或ISP设置的防火墙阻止端口22上的SSH连接,通常会发生这种情况.快速解决方法是查看是否存在问题,请尝试使用HTTPS Github提供的URL:
git remote add origin-https https://github.com/alicht/tweetanuber.git
git push -u origin-https master
Run Code Online (Sandbox Code Playgroud)
如果可行,那么肯定是您的SSH端口被关闭了.您可以继续使用此备用语法,尝试在您的计算机或ISP上取消阻止端口22,或查看/sf/answers/565690471/上的建议,看看它是否适合您.
原因可能是您在网络下修改了防火墙。(在这种情况下,他们可能会故意阻止某些端口):在我的情况下,我在图书馆,防火墙正在阻止。对于这项工作在终端上做:
git config --local -e
Run Code Online (Sandbox Code Playgroud)
并更改此设置(使用 vim,您需要输入键盘“i”进行插入):
url = git@github.com:username/repo.git
Run Code Online (Sandbox Code Playgroud)
为了这:
url = https://github.com/username/repo.git
Run Code Online (Sandbox Code Playgroud)
然后保存(输入键盘 ESC 然后输入 wq! 和 Enter)。
然后再次尝试推动。
归档时间: |
|
查看次数: |
40501 次 |
最近记录: |