我正在尝试连接到学校的github,但端口443被阻止.
管理员告诉我使用端口9418,我相信它是git协议的默认端口.
但是在git bash(windows)中,如果我尝试做git remote set-url origin git://github.com/me/myrepo.git并进行推送,它告诉我我不能推送到这个URL,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协议是只读的.
小智 6
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>
Run Code Online (Sandbox Code Playgroud)
新:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://git@domain.com:<port>/<project name>
Run Code Online (Sandbox Code Playgroud)