1
  1. I installed gitea (similar to gitlab)
  2. I added a valid public key in user settings -> SSH KEY
  3. gitea port 3000

run:

ssh -p 22  -Tvv  git@***.***.***.***  

out:

debug1: Found key in C:\\Users\\client/.ssh/known_hosts:17
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug2: key: C:\\Users\\client/.ssh/id_rsa (000001FBAD96F620)
debug2: key: C:\\Users\\client/.ssh/id_dsa (0000000000000000)
debug2: key: C:\\Users\\client/.ssh/id_ecdsa (0000000000000000)
debug2: key: C:\\Users\\client/.ssh/id_ed25519 (0000000000000000)
debug2: key: C:\\Users\\client/.ssh/id_xmss (0000000000000000)
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:W88rhRw****** C:\\Users\\client/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\client/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\client/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\client/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\client/.ssh/id_xmss
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@***.***.***.***'s password:

I really don't understand why?

Before that, gitlab was installed,ssh worked normally, but then gitlab was uninstalled andgitea was installed

may I know what is the reason?


in server, run: top

 PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                                 
 1185 root      20   0  972600 158792  44828 S   0.0  7.7   0:06.96 gitea 

Is there any difference between ssh git@***.***.***.*** and ssh root@***.***.***.***?

ebyte
  • 1,229
  • 1
  • 9
  • 25
  • According to the debug output, your client offered _id_rsa_ to the remote server, and the server didn't accept it. What key file is your client supposed to use for gitea? – Kenster Feb 09 '20 at 15:44

1 Answers1

0

One possible reason SSH would default to asking git password is because:

You can test that by generating a simpler SSH key, for testing, without passphrase:

ssh-keygen -t rsa -m PEM -P ""
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
  • thanks, `added to an SSH agent`:My system is `windows10`, I run` Pageant.exe`, and add the key – ebyte Feb 09 '20 at 11:36
  • @ebyteebyte Never use Pageant in Windows, always OpenSSH. See https://stackoverflow.com/a/35111050/6309 – VonC Feb 09 '20 at 11:38
  • Still the same as before, does this have to do with the user who runs `gitea` as `root` instead of `git`? – ebyte Feb 09 '20 at 12:09
  • @ebyteebyte Yes: nothing should run as root beside system tasks. – VonC Feb 09 '20 at 13:33