Search code examples
macossshterminalportscp

How can I upload a file via ssh to my server with a different port then 22?


I try to upload a file via ssh to my server:

scp -p 2222 user@myhost:/Users/myuser/mypage/myrepository.git

I get the error message:

ssh: connect to host myhost port 22: Connection refused

How do I specify scp to use port 2222?


Solution

  • This worked for me:

    scp -P 2222 -r myrepository.git user@myhost:/Users/myuser/mypage/