问题描述
我的VPS提供商建议我将我的SSH端口留给他们默认分配的自定义端口号(不是22)。事情是,虽然我知道我可以给端口号,当创建一个远程配置,似乎我做不了相同的做一个git克隆。我使用gitolite所以我克隆命令看起来像:
git clone [email protected]:gitolite-admin
有没有办法将其转换为使用自定义ssh端口号?
$ b $ b 我还应该提到我在windows上运行cygwin。我看到多个地方说要添加自定义端口到〜/ .ssh / config
文件,如
Host mydomain.com
Port 12345
,该文件似乎不存在。
解决方案 git clone ssh:// git @ mydomain.com:[port] / gitolite-admin
My VPS provider recommends that I leave my SSH port to the custom port number they assign it by default (not 22). The thing is the while I know I can give the port number when create a remote config, it seems like I can't do the same when doing a git clone. I am using gitolite so I clone commands look like:
git clone [email protected]:gitolite-admin
Is there a way to covert this to using the custom ssh port number?
I should also mention I am running cygwin on windows. I have seen multiple places saying to add the custom port to the ~/.ssh/config
file like
Host mydomain.com
Port 12345
however in cygwin, that file does not seem to exist.
解决方案 git clone ssh://[email protected]:[port]/gitolite-admin
这篇关于Git在自定义SSH端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!