[英]Git - Use port 9418 for remote on github
我正在尝试连接到学校的 github,但端口 443 被阻止。
管理员告诉我改用端口 9418,我认为这是 git 协议的默认端口。
但是在 git bash (windows) 中,如果我尝试执行 git remote set-url origin git://github.com/me/myrepo.git
并进行推送,它告诉我无法推送到此 881265886,6使用https://github...
代替。
如何配置 git 使用端口 9418?
来自github文档 :
您只能推送到两个可写协议URL地址之一。 这两个包括一个SSH URL,如git@github.com:user / repo.git或HTTPS URL,如https://github.com/user/repo.git 。
所以你需要打开端口22或443才能工作,git协议是只读的。
check: ReadyState4或git remote add with other ssh port
一种方法: git remote add origin ssh://git@domain.com:<port>/<project name>
第二种方式:更改.git/config
旧:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@domain.com:<project name>
新:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://git@domain.com:<port>/<project name>
试试这个,它会减轻你的生活
sed -i '/npm install/i \
RUN git config --global url."git@github.com:org".insteadOf
"git://github.com/org" \
' Dockerfile
从这个博客: https://github.blog/2021-09-01-improving-git-protocol-security-github/,github不再支持 git 协议。
在 Git 协议端,未加密的 git:// 不提供完整性或身份验证,因此容易被篡改。 我们预计很少有人仍在使用此协议,尤其是考虑到您无法推送(它在 GitHub 上是只读的)。 我们将禁用对该协议的支持。
您应该使用ssh
或https
更改协议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.