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

Time:08-13

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?

CodePudding user response:

scp uses an upper-case P to specify the port. Try this instead:

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

CodePudding user response:

This worked for me:

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