gitea: Deploy key does not have access to private repository

  • Gitea version (or commit ref): 1.2 (Docker image 3e606f47a47e)
  • Git version: not relevant
  • Operating system: not relevant
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I tried to use a deploy key with a private repository on a private instance of Gitea running in a Docker container. Apparently, for private Git repositories, the deploy key doesn’t have permission to read the repository, though.

Cloning into '.'...
Gitea: Invalid key ID
Invalid key ID[key-1]: public key does not exist [id: 1]
fatal: Could not read from remote repository.

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

As soon as I publish the repository, the key works as expected.

It’s a bit disruptive to have to switch the state of a repository for every deployment. I’d propose to allow deploy keys to clone the relevant repository even if it’s private.

(I think a workaround might be to add a “machine user” or something like that, and add that to the repository.)

Oh, and please, improve that error message a bit. I’m not even sure whether the current behavior is intended, the message in the log extract I posted actually implies it might be an error.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments