I have gogs installed and I can clone my repos with http link in sourcetree, but now I´m trying to integrate with jenkins. The problem is I get a message: port 22 rejected so I tried to directly clone my repo from the server with jenkins through git bash. And still port 22 rejected. Please someone could tell me how to deal with gogs and ssh, so finally I can integrate it with jenkins properly?
Asked
Active
Viewed 3,103 times
2 Answers
0
According to the default gogs configuration file, serving repositories over SSH (port 22) is not enabled by default. Therefore any attempts to connect to this port would be rejected.
Make sure you enable the relevant settings, and test that you can clone via SSH from your computer before trying with Jenkins.

Christopher Orr
- 110,418
- 27
- 198
- 193
-
The point is im testing to clone via SSH from one computer but I still get port 22 rejected. Im trying through git-bash. In my gogs config I have DISABLE_SSH = false. From that I understand ssh is enabled, it is? – Federico Feb 15 '16 at 17:12
-
@Federico Yes, that was clear from your question. But as I mentioned, if your connection attempts are being rejected by the server, then quite likely the server does not have SSH access enabled. Have you enabled SSH in the gogs configuration? – Christopher Orr Feb 15 '16 at 17:15
-
how do i check if it is configured? apart from seeing gogs configuration file? As long as i know gogs doesn´t have ssh by default – Federico Feb 15 '16 at 17:32
-
If you don't want to (or can't) look in the configuration file for some reason, you could use netstat on the server to see whether it's listening on port 22. Or ask the person who set up the server. And yes, as I mentioned in my answer, SSH does not appear to be enabled by default in gogs. – Christopher Orr Feb 15 '16 at 19:06
-
In your now-edited first comment you say "I have DISABLE_SSH = false." Read the rest of the configuration file — there is more than one SSH-related option, as you can see in the first link in my answer. – Christopher Orr Feb 15 '16 at 19:48
0
If the gogs process is ran by a user who is not part of the sudo
group then the script won't be able to listen on ports below 1024. Set it to something above (e.g. 2222
) and it should work.

SeinopSys
- 8,787
- 10
- 62
- 110