Search code examples
gitsshgit-pullgit-push

Git over port 443


I have a git repository on my server i can ssh over port 443. But now i want to pull from that server and push to it but git gives me connection refused. I think it's connecting over port 22 but i want it to connect over 443. I use tortoiseplink to connect with how can i make it connect through port 443 when pushing or pulling ?


Solution

  • First, git will execute the command in a shell where it will look for the environment variable HOME (which is not a Windows standard environement variable).
    So make sure it does reference a correct path (any path you want)

    Then ssh will look for your your public and private key in ~/.ssh/id_rsa(.pub).
    Make sure you have them there (you can generate them in a Git bash session: ssh-keygen -t rsa.
    Make also sure you have the public key copied in 'authorized_keys' (which you have, since you can ssh on the server)

    Finally, in your HOME/.ssh directory, create a file named 'config':

    host remoteServer
    user yourLogin
    hostname remoteServerName
    port 443
    identityfile ~/.ssh/id_rsa
    

    You should then be able to use git pull or git push

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