Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git通过端口443_Git_Ssh_Git Pull_Git Push - Fatal编程技术网

Git通过端口443

Git通过端口443,git,ssh,git-pull,git-push,Git,Ssh,Git Pull,Git Push,我的服务器上有一个git存储库,我可以通过端口443进行ssh。但现在我想从那个服务器上拉并推到它,但git给我的连接被拒绝了。我想它是通过端口22连接的,但我希望它通过443连接。我使用tortoiseplink连接,如何在推拉时使其通过端口443连接?定义远程设备,使其使用端口443,或设置ssh配置,使其知道该主机使用端口443 git remote add origin ssh://some.host:443/path/to/repo.git 首先,git将在shell中执行该命令,并

我的服务器上有一个git存储库,我可以通过端口443进行ssh。但现在我想从那个服务器上拉并推到它,但git给我的连接被拒绝了。我想它是通过端口22连接的,但我希望它通过443连接。我使用tortoiseplink连接,如何在推拉时使其通过端口443连接?

定义远程设备,使其使用端口443,或设置ssh配置,使其知道该主机使用端口443

git remote add origin ssh://some.host:443/path/to/repo.git

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

然后ssh将在
~/.ssh/id\u 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
然后,您应该能够使用git pull或git push

git pull remoteServer:/path/to/repo.git