# Gitea creating wrong ssh key on authorized\_keys

**URL:** <https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432>\
**Category:** Install/Maintain/Configure\
**Created:** [July 11, 2024, 1:52pm UTC](https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432 "2024-07-11T13:52:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fellipeh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/fellipeh/32/6092_2.png) [@fellipeh](https://forum.gitea.com/u/fellipeh)\
**Post date:** [July 11, 2024, 1:52pm UTC](https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432/1 "2024-07-11T13:52:55Z")

</div>

Hey y’all… I’m facing an weird error: I finished the setup and everything work fine… I created my user, and an repository, cloned using ssh… but when I try to push my code, ask for `gitea` password:

```auto
$ git push -u origin main
(gitea@192.168.23) Password:

```

I already added my ssh key on my user… and when I got to the `authorized_keys` gitea user, I see an command line there, not my user key:

```auto
$ cat /home/gitea/.ssh/authorized_keys
# gitea public key
command="/usr/bin/gitea --config=/etc/gitea/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa AAAAbbbbbCCCCC=

```

Appears gitea works fine in the part of including users keys on gitea authorized\_keys, but it’s including the command line too…

p.s.: I’m using the default ssh server not the gitea “ssh server”

it’s a bad configuration or an bug?

thanks for all!

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/techknowlogick/32/4706_2.png) [@techknowlogick](https://forum.gitea.com/u/techknowlogick)\
**Post date:** [July 12, 2024, 4:42pm UTC](https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432/2 "2024-07-12T16:42:03Z")

</div>

Hi @fellipeh, thanks for the report. Just a few questions: What key is being added (is it one you haven’t seen before)? Are you the only user on your instance?  
Thanks!

---

<div class="post-metadata">

**Author:** ![fellipeh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/fellipeh/32/6092_2.png) [@fellipeh](https://forum.gitea.com/u/fellipeh)\
**Post date:** [July 12, 2024, 5:43pm UTC](https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432/3 "2024-07-12T17:43:47Z")

</div>

Hey @techknowlogick I found the issue… In the end, when I connect using ssh port 22, I was connecting to the gitea machine ssh, not the “gitea ssh”… I changed the `app.ini` to start the ssh server, and set port 2222… and using `gitea ssh` works pretty good!!

The point here I read the docs, and didn’t find this in particular… maybe will be good to have this note on the install process…

thanks!

---

<div class="post-metadata">

**Author:** ![pjgoodall](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/pjgoodall/32/2967_2.png) [@pjgoodall](https://forum.gitea.com/u/pjgoodall)\
**Post date:** [July 26, 2024, 4:02am UTC](https://forum.gitea.com/t/gitea-creating-wrong-ssh-key-on-authorized-keys/9432/4 "2024-07-26T04:02:19Z")

</div>

There are two ssh servers - which are we starting where?  
Most of the discussions of this problem - and I have seen at least three, never make this clear. Often the problem remains unsolved as far as I can see. Though the solution is probably simple.
