Git在443端口

sla*_*rIQ 3 git ssh git-pull git-push

我在我的服务器上有一个git存储库,我可以通过端口443 ssh.但是现在我想从该服务器拉出并推送到它但是git让我拒绝连接.我认为它通过端口22连接,但我希望它通过443连接.我使用tortoiseplink连接如何在推或拉时通过端口443连接?

jam*_*san 6

定义您的遥控器,使其使用端口 443,或设置您的 ssh 配置,使其知道对该主机使用端口 443。

git remote add origin ssh://some.host:443/path/to/repo.git
Run Code Online (Sandbox Code Playgroud)


Von*_*onC 6

首先,git将在shell中执行命令,它将查找环境变量HOME(它不是Windows标准的环境变量).
因此,请确保它确实引用了正确的路径(您想要的任何路径)

然后ssh将查找您的公钥和私钥~/.ssh/id_rsa(.pub).
确保你有它们(你可以在Git bash会话中生成它们:ssh-keygen -t rsa.
确保你在' authorized_keys'中复制了公钥(你有,因为你可以在服务器上ssh)

最后,在您的HOME/.ssh目录中,创建一个名为' config' 的文件:

host remoteServer
user yourLogin
hostname remoteServerName
port 443
identityfile ~/.ssh/id_rsa
Run Code Online (Sandbox Code Playgroud)

然后你应该能够使用git pull或git push

git pull remoteServer:/path/to/repo.git
Run Code Online (Sandbox Code Playgroud)