SSH on Windows configuration and usage

I’m struggling to get SSH working on my Windows 10 system. I first want to get Gitea running on the same system I’m also using git client. So I’m not using a server and try to clone from another client.
I read dozens of articles on SSH, OpenSSH, inspected the GIT documentation and Gitea manuals.
Also here on the forum I see some questions.

But whatever I do, it will not work. Maybe I do not grasp the basics of SSH but I do not understand how it can actually work at all.

Gitea is working fine using HTTP.

So this is what I have done.
I’m running Gitea and in the configuration I see:

RUN_MODE = prod

That is already strange as I’m running Gitea as this Windows user: Sandra

I have setup OpenSSH client and server on the machine.
No problem when I do this in command line:

ssh sandra@localhost

It asks me password and SSH connects and I can get in.

The clone command (as given in Gitea) for a repository is this:


How can this in principle work at all?

When I do this in command line:

ssh SYSTEM@localhost

This is the result:

Connection reset by ::1 port 22

So, just ignoring this and change the clone command to use Sandra as user and not SYSTEM:

git clone Sandra@localhost:MyCompany/TestRepo.git

Cloning into 'TestRepo'...
Sandra@localhost's password:
'git-upload-pack' is not recognized as an internal or external command,
operable program or batch file.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Even then I do not understand how a Gitea user (created within Gitea) can ever use SSH without creating the real user on the system. Let’s say I create a user Patrick in Gitea. This user Patrick is not a Windows user, so how can you setup SSH access?

How can Patrick as Gitea user clone a repo having always the SSH username of SYSTEM?

I’m totally lost. I hope someone can explain me what I’m doing wrong.

I don’t have any experience running Gitea on Windows, but from this guide, it looks like they recommend running as RUN_USER = COMPUTERNAME$ where COMPUTERNAME is whatever this command outputs echo %COMPUTERNAME%.

As for configuring SSH, typically a Linux SSH server will look in the user’s home directory for the file .ssh/authorized_keys which Gitea configures. For Windows, if Gitea is not configuring the [USER HOME]\.ssh\authorized_keys you will need to specify it in the SSH servers configuration like so:

     AuthorizedKeysFile C:\wherever\.ssh\authorized_keys

Make sure this is at the bottom of the SSH configuration. This is assuming your Windows SSH server is OpenSSH or uses its configuration syntax.

1 Like

Hello, I have run into the exact same problem, did you find a solution ?