Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting remote to use specified port for ssh

Tags:

git

I have ssh keys setup to work on a specified port (e.g. 12345) and issued the following git command to set the origin on a local repo.

git remote add origin [email protected]:12345/path/to/public_html/files/

I am getting the following error message when i try to push to origin.

ssh: connect to host mydomain.com port 22: Connection refused
fatal: The remote end hung up unexpectedly

How do i set origin so it is using the proper port for ssh?

like image 661
Jay Avatar asked Feb 03 '23 14:02

Jay


1 Answers

To specify a custom port, you have to add the ssh:// prefix. Otherwise, git interprets your 12345 as part of the project's path. See URLs in the git-pull docs. So:

git remote add origin ssh://[email protected]:12345/path/to/public_html/files/
like image 185
Ryan Stewart Avatar answered Feb 05 '23 02:02

Ryan Stewart