# SSH on Windows configuration and usage

**URL:** <https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477>\
**Category:** Install/Maintain/Configure\
**Created:** [January 3, 2023, 12:12pm UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477 "2023-01-03T12:12:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xymox](https://avatars.discourse-cdn.com/v4/letter/x/9fc29f/32.png) [@Xymox](https://forum.gitea.com/u/Xymox)\
**Post date:** [January 3, 2023, 12:12pm UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477/1 "2023-01-03T12:12:52Z")

</div>

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\_USER = SYSTEM  
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:

`SYSTEM@localhost:MyCompany/TestRepo.git`

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`

```auto
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.

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [January 3, 2023, 9:26pm UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477/2 "2023-01-03T21:26:46Z")

</div>

I don’t have any experience running Gitea on Windows, but from [this guide](https://docs.gitea.io/en-us/windows-service/), 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:

```auto
Match User COMPUTERNAME$
     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.

---

<div class="post-metadata">

**Author:** ![lch](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@lch](https://forum.gitea.com/u/lch)\
**Post date:** [July 25, 2023, 9:30am UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477/3 "2023-07-25T09:30:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![git214](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@git214](https://forum.gitea.com/u/git214)\
**Post date:** [August 11, 2024, 9:46pm UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477/4 "2024-08-11T21:46:04Z")

</div>

I’m having SSH cloning issues on Windows 10 also and have had no success in finding a solution. I see your post in very old without showing any closure. I have posted a message in a different category. Have you discovered any that fixed the issue?

---

<div class="post-metadata">

**Author:** ![git214](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@git214](https://forum.gitea.com/u/git214)\
**Post date:** [August 12, 2024, 3:12am UTC](https://forum.gitea.com/t/ssh-on-windows-configuration-and-usage/6477/5 "2024-08-12T03:12:13Z")

</div>

I solved my SSH clone issues which I will document in my second post on this issue.

> [@SSH git clone on Windows 10 does not work at all](https://forum.gitea.com/t/ssh-git-clone-on-windows-10-does-not-work-at-all/9587):
>
> SSH git clone on Windows 10 does not work at all. For three days, I’ve been at this. No answer yet. Please someone tell me what I’m doing wrong here. I need a step-by-step answer. Windows 10 Gitea 1.50 OpenSSH and Gitea Built-in SSH servers I’m attempting to ssh clone from Windows 10 Gitea host server to a Windows 11 client. ssh user@host - works without using a password ssh user@host -p 22 - works without using a password git clone [http://host-ip:3000/user/repo.git](http://host-ip:3000/user/repo.git) - works git clone…
