4

My Gitea version is 1.2.3 and it's install on a gentoo dedicated server. I created my SSH key on another dedicated server with my user (not the root one).

On the Gitea GUI, I created an Organization and a repo for that organization, my gitea user is the owner of all of that (not the root account)

When I go to [Organization]/ [MyRepo] > Settings > Deploy keys, I add the ssh key of my remote user. Gitea add that key to the authorized_key file in the .ssh git user (git user is the user for gitea)

From my remote, when I tried that :

ssh git@[gitea_server_ip]

I've got this message :

Hi there, You've successfully authenticated, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user.

So SSH work well, but when I tried a push or clone, I get that :

git push -u origin master

Answer :

Gitea: Key permission denied  
Cannot push with deployment key: 5 
fatal: Could not read from remote repository

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

It's seems to be a gitea authentication problem but I don't find the answer, thanks.

Tarkaros
  • 153
  • 2
  • 7
  • AFAIU your ssh key for pushing must be user key, not deployment key. See https://github.com/go-gitea/gitea/issues/938 – phd Jan 09 '18 at 14:58
  • Ok so what should I use ? Because I generated the key with my remote user and use it for the deploy key, this is the wrong way ? Thanks for your help – Tarkaros Jan 09 '18 at 15:21
  • I found the following info about deploy keys for Github ([1](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys), [2](https://gist.github.com/zhujunsan/a0becf82ade50ed06115)) and [Gitlab](https://docs.gitlab.com/ce/ssh/README.html#deploy-keys). I think it's similar with gogs/gitea — you need to create new or use existing user key, add its public key to gitea account and reconfigure ssh to use its private key to connect to the server. – phd Jan 09 '18 at 18:38
  • In what you tell to do I had already do all of that except the part "reconfigure ssh to use its private key to connect to the server", what do you mean exactly ? Because I can't give private key to the other server, isn't it ? – Tarkaros Jan 11 '18 at 15:58
  • You now have 2 ssh keypairs — user key and deploy key. You need to [configure ssh](https://stackoverflow.com/q/2419566/7976758) to allow git to use one or the other. Of course you don't publish your private keys. – phd Jan 11 '18 at 18:31
  • I finally find a solution but it's seems to be a weird way. Instead of putting the key to the organization project, I put it to my gitea user, wich his owner of organization and the project, and it's work. So I think I will create a user for the server, maybe it's the most proper way. Thanks a lot for your help, all your links help me to find that. – Tarkaros Jan 12 '18 at 08:11

1 Answers1

0

This message comes if you use a deployment key without write access or the write option is not finnish in implementation for your gitea version. I get this error: Gitea: Key permission denied Cannot push with deployment key: 14 fatal: Could not read from remote repository If this account only has read permissions.

You may use the standard ssh auth: < gitea:port >/user/settings/keys Add your public key an then it should work.

f b
  • 115
  • 10