Problem using non-standard port when deploying with git

Hello,

What do I need to change in the deploy.rb or elsewhere in order to use a
non-default port number?

Everything is working fine when I use the standard port 22 on my server.
I’m able to deploy my code with capistrano and github.

Now I changed my port number to something higher -say - 1234.

I also updated the deploy.rb with this line:

‘ssh_options[:port] = 1234’

This works if I do a single command such as cap deploy:cleanup

BUT when I try to deploy updated code via GitHub I now get the following
error:

‘ssh: connect to host github.com port 1234: Connection refused’

When I remove the ‘ssh_options[:port] = 1234’ line from deploy.rb again
this error doesn’t happen but instead:

‘Capistrano::ConnectionError, connection failed for: xx.xx.x.xx
(Errno::ECONNREFUSED: Connection refused - connect(2))’

So does anybody know how to solve this?
What do I need to change in the deploy.rb or elsewhere in order to use a
non-default port number?

Thanks a lot for any help!

Justus

rubyphunk wrote:

You could add github.com to your ~/.ssh/config file and define a non-
default port:

Host github.com
Port 1234

rubyphunk

On 9 Okt., 16:45, Justus O. [email protected]

Hi, thanks.

But this doesn’t work. It looks like it is trying to connect to github
at this port ('‘ssh: connect to host github.com port 1234: Connection
refused’) but that’s not what I am trying to do.

All I am trying to specify is that to access my production server port
1234 needs to be used.

How can I specify this correctly in the deploy.rb?

Thanks again,
Justus

You could add github.com to your ~/.ssh/config file and define a non-
default port:

Host github.com
Port 1234

rubyphunk

On 9 Okt., 16:45, Justus O. [email protected]

On Oct 9, 9:09 am, Justus O. [email protected]
wrote:

But this doesn’t work. It looks like it is trying to connect to github
at this port ('‘ssh: connect to host github.com port 1234: Connection
refused’) but that’s not what I am trying to do.

All I am trying to specify is that to access my production server port
1234 needs to be used.

How can I specify this correctly in the deploy.rb?

You can try putting an entry in your local .ssh/config file (~/.ssh/
config) that includes the port, and then connecting. I’m not sure if
it’ll work, but it’s worth a shot. Just add something like:

host = yourservername.com
port = 1234

Now, anytime you try to ssh to yourservername.com, it’ll try the
connection over port 1234 instead of 22.