简体   繁体   English

Git - 在 github 上远程使用端口 9418

[英]Git - Use port 9418 for remote on github

I am trying to connect to github at school but port 443 is blocked.我正在尝试连接到学校的 github,但端口 443 被阻止。

The admin told me to use port 9418 instead which I believe is the default port for the git protocol.管理员告诉我改用端口 9418,我认为这是 git 协议的默认端口。

But in git bash (windows) if i try to do git remote set-url origin git://github.com/me/myrepo.git and do a push, it tells me I can't push to this URL, and to use https://github... instead.但是在 git bash (windows) 中,如果我尝试执行 git remote set-url origin git://github.com/me/myrepo.git并进行推送,它告诉我无法推送到此 881265886,6使用https://github...代替。

How can I configure git to use port 9418?如何配置 git 使用端口 9418?

From github documentation : 来自github文档

You can only push to one of two writeable protocol URL addresses. 您只能推送到两个可写协议URL地址之一。 Those two include an SSH URL like git@github.com:user/repo.git or HTTPS URL like https://github.com/user/repo.git . 这两个包括一个SSH URL,如git@github.com:user / repo.git或HTTPS URL,如https://github.com/user/repo.git

So you need open port 22 or 443 to work, git protocol is read only. 所以你需要打开端口22或443才能工作,git协议是只读的。

check : ReadyState4 or git remote add with other ssh port check: ReadyState4git remote add with other ssh port

One way : git remote add origin ssh://git@domain.com:<port>/<project name> 一种方法: git remote add origin ssh://git@domain.com:<port>/<project name>


Second way : change the .git/config 第二种方式:更改.git/config

old: 旧:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = git@domain.com:<project name>

new: 新:

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = ssh://git@domain.com:<port>/<project name>

try this, it"ll ease your life试试这个,它会减轻你的生活

sed -i '/npm install/i \
RUN git config --global url."git@github.com:org".insteadOf 
"git://github.com/org" \
' Dockerfile

from this blog: https://github.blog/2021-09-01-improving-git-protocol-security-github/ , github did not support git protocol anymore.从这个博客: https://github.blog/2021-09-01-improving-git-protocol-security-github/,github不再支持 git 协议。

On the Git protocol side, unencrypted git:// offers no integrity or authentication, making it subject to tampering.在 Git 协议端,未加密的 git:// 不提供完整性或身份验证,因此容易被篡改。 We expect very few people are still using this protocol, especially given that you can't push (it's read-only on GitHub).我们预计很少有人仍在使用此协议,尤其是考虑到您无法推送(它在 GitHub 上是只读的)。 We'll be disabling support for this protocol.我们将禁用对该协议的支持。

you should change the protocol with ssh or https .您应该使用sshhttps更改协议。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不再支持端口 9418 上未经身份验证的 git 协议 - The unauthenticated git protocol on port 9418 is no longer supported git-daemon:“无法在主机(null)端口9418上分配任何侦听套接字” - git-daemon: “unable to allocate any listen sockets on host (null) port 9418” 即使我可以远程登录到端口9418,“ git clone”也会产生挂断错误 - “git clone” yields hangup error even though I can telnet to port 9418 无法在git pull请求上查找https(端口9418)(提供的节点名或服务名,或未知) - unable to look up https (port 9418) (nodename nor servname provided, or not known) on git pull request Android-回购同步失败并显示致命错误:无法查找android.git.kernel.org(端口9418)(名称或服务未知) - Android - repo sync fails with fatal: Unable to look up android.git.kernel.org (port 9418) (Name or service not known) 如何从服务器端口 9418 克隆存储库? - How to clone repositories from server port 9418? 我将git远程连接到GitHub,这是错误的 - I remote git to GitHub, It wrong 在不在GitHub或anyHub上的git中添加远程 - Adding remote in git that is not on GitHub or anyHub SSH到远程服务器时,如何强制git使用其他端口? - How do I force git to use a different port when ssh'ing to a remote? Git软件(例如Gitbox,Github,SourceTree)可以使用远程仓库代替本地吗? - Can Git software (e.g. Gitbox, Github, SourceTree) use a remote repo instead of local?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM