gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.28k stars 670 forks source link

All ssh related settings disappeared after upgrade from v1.8.0 #1436

Open esonhon opened 1 year ago

esonhon commented 1 year ago

I just upgrade my self hosted gitblit from v1.8.0 to v1.9.3, use the war package to deploy, then copy and overrite the WEB-INF/data projects.conf users.conf and git folder from the old version. Everythings works except all SSH related functions gone. SSH can not be connected, SSH key settings menu not found. Have checked the default.properties config, ssh port is 29418.

flaix commented 1 year ago

Did you check the log? It usually say something about SSH port being opened.

esonhon commented 1 year ago

@flaix Thanks. BTW, Do you mean the gitblit log? I can not find any .log file in gitblit install folder.

flaix commented 1 year ago

Yes, I mean the Gitblit logging. I don't know where logging goes when run as a WAR in an application server, I don't run it that way. I would have to try it myself, as I cannot think of any cause. But I won't get to do that before the weekend. :(

flaix commented 1 year ago

What is your application server? And how did you update?

esonhon commented 1 year ago

Tomcat 7 with JDK 7 and 8 I just have a brand new installation, SSH option still can not be find. But in version 1.8.0, it works.

flaix commented 1 year ago

I could not reproduce this. You may have to provide detailed steps how to reproduce this. I have downloaded Tomcat 7.0.109 and have unpacked the tar.gz file on a Linux Mint 19.1. This is using OpenJDK 8. I have started the Tomcat server and checked the open HTTP port:

$ ps ax | grep tomcat
11876 pts/0    Sl     0:16 /usr/lib/jvm/java-8-openjdk-amd64/bin/java  [...] org.apache.catalina.startup.Bootstrap start

$ sudo netstat -tlpn   
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      561/systemd-resolve 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      647/cupsd           
tcp6       0      0 :::8080                 :::*                    LISTEN      11876/java          
tcp6       0      0 ::1:631                 :::*                    LISTEN      647/cupsd           
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      11876/java      

I have then downloaded the gitblit-1.9.3.war file and have copied it into the webapps folder as gitblit.tar.gz. A few seconds later I had a running instance under http://localhost:8080/gitblit. I could log in as admin and create a new repository with an initial commit.

The repository page did show the SSH URI (ssh://admin@localhost:29418/test.git) by default, which I did copy and I could run a clone command successfully over SSH.

Running netstatagain showed that the Tomcat app had the Git and SSH ports open:

$ sudo netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      561/systemd-resolve 
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      647/cupsd           
tcp6       0      0 :::29418                :::*                    LISTEN      11876/java          
tcp6       0      0 :::9418                 :::*                    LISTEN      11876/java          
tcp6       0      0 :::8080                 :::*                    LISTEN      11876/java          
tcp6       0      0 ::1:631                 :::*                    LISTEN      647/cupsd           
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      11876/java 

So I would say that in general it works and it'll need more detail and research why it doesn't work in your case.

The Gitblit logs are written to the container logs. I could find them in apache-tomcat-7.0.109/logs/catalina.out. This file contained for example:

2022-11-11 21:52:16 [INFO ] ----[com.gitblit.manager.IServicesManager]----
2022-11-11 21:52:16 [INFO ] Federation passphrase is blank! This server can not be PULLED from.
2022-11-11 21:52:16 [INFO ] Fanout PubSub service is disabled.
2022-11-11 21:52:16 [INFO ] Git Daemon is listening on 0.0.0.0:9418
2022-11-11 21:52:16 [INFO ] Generating RSA-2048 SSH host keypair...
2022-11-11 21:52:16 [INFO ] Generating DSA SSH host keypair...
2022-11-11 21:52:17 [INFO ] SSH: adding public key authentication method.
2022-11-11 21:52:17 [INFO ] SSH: adding password authentication method.
2022-11-11 21:52:17 [INFO ] SSH Daemon (NIO2) is listening on 0.0.0.0:29418
2022-11-11 21:52:17 [INFO ]