Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eb112's avatar
Level 2

Github deploy key confusion

I think I'm misunderstanding something fundamental about deploy keys. Here's the situation.

We have a server set up through Forge. Git repository (private) is working great. Let's call it Repository-A.

Today, I set up a new personal Forge account, set up the server, and tried to copy/paste the deploy key from Forge to my Github repository (Repository-B). I got the message, "Key is already in use" from Github. The Repository-A and -B are managed by the same Github organization account.

I don't understand this at all. I assumed that each server managed by Forge had its own SSH key, in which case, how could a key on a new server already be in use?

0 likes
4 replies
bobbybouwmann's avatar

You need to think the other way around. Forge is one server that manages all deployments and has all details of your server and deployment. So Forge will do a request to Github to access your repository. Therefore your Github account need to have that key. After that Forge and your Github account can communicate together.

So the only unique parts are Github and Forge. If you use the same account, the deployment key is the same.

Now I see that you mentioned you have multiple Forge accounts right? Do they both use the same server or are they unique?

eb112's avatar
Level 2

Thanks for the reply. I have two Forge accounts, two unique servers, and one Github account.

I figured it out: when I set up Forge, I linked it to my GitHub account. I removed the related ssh key from GitHub and now everything works fine. I don't fully understand what happened here, but everything works fine now.

Firemaps's avatar

Forge added the key to the admins github account

We removed it from their account and added it as a deploy key and now it works fine !

gastoncampana's avatar

¡Hi! My team encountered the same or a very similar problem.

We asked the Forge support team for a solution and they responded very quickly, telling us that there's two possible workarounds for this:

  1. There's a Deployment Key per site that can be used per repository that can be found in https://forge.laravel.com/servers/[server_id]/sites/[site_id]/settings under the "Site's Deploy Key" header. Adding each site deploy key to each associated repository should do the trick. But it must be one-to-one relationship.
  • This did not solve the issue for us, because the server never tried to connect via SSH using this key, so we tried the other solution.
  1. The general per server SSH key must be removed from every repository and added ONLY to a single GitHub user that's admin of all the repositories that will be used on that server. This means you have to add the per server SSH key to https://github.com/settings/keys as an Authentication Key.
  • This was the correct answer for us.

¡Hope it helps! Happy coding,

Gaston from Persiscal

1 like

Please or to participate in this conversation.