79339499

Date: 2025-01-08 14:20:28
Score: 2
Natty:
Report link

I found the cause. It looks a trivial issue but not easy to realize.

First, I will explain each command why it works or doesn't work.

So just adding a bare entry to the file like below, accessing "ssh user1@myserver" or "ssh user1@real-ip" will work well, but git+SSH absolutely does not work.

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvf4l5RjqWL+kOnxpqhhGAIcIkWVSHqLbgkAzMAlYGm user1@domain

The reason is the missing a part that links SSH key to the git operations that explains why SSH auth is OK but git does not recognized the repo path. So the correct syntax to connect git to SSH should look like below:

command="/usr/local/bin/gitea --config=/etc/gitea/app.ini serv key-6",no-port-forwarding,no-X11-forwarding,no-user-rc,no-pty,restrict ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIvf4l5RjqWL+kOnxpqhhGAIcIkWVSHqLbgkAzMAlYGm user1@domain

It is quite long to manually edit, it'd better to let gitea adding that for us via web UI. But one issue appears, since the "command" comes in, the SSH shell access using "user1" becomes impossible. I don't know how to enable access via both git+SSH and SSH for the same user. My solution is to create a new key for pure SSH access or consider enable the PasswordAuthentication option.

Notes I want to share:

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-1): solution is
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • No code block (0.5):
  • User mentioned (1): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): user1
  • User mentioned (0): @grawity_u1686
  • User mentioned (0): @grawity_u1686
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: SteveH