"Permission denied (publickey)" on deployment

I have a Netlify website (mystifying-shannon-c21cd8.netlify.app) privately hosted based on the Hugo starter-academic template (repo here: GitHub - Timsey/starter-academic). Today I pushed some updates, which are reflected in the remote repo, but deployment now repeatedly fails with the following error:

9:37:15 PM: build-image version: ecdc8b770f4a0193fd3f258c1bc6029e681813a4 (focal)
9:37:15 PM: buildbot version: 5ff1f297aa225d2ec877d89104672fd74916351d
9:37:15 PM: Fetching cached dependencies
9:37:15 PM: Failed to fetch cache, continuing with build
9:37:15 PM: Starting to prepare the repo for build
9:37:16 PM: Failed during stage 'preparing repo': For more information, visit https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-with-error-128: Warning: Permanently added 'github.com' (ECDSA) to the list of known hosts.

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
: exit status 128
9:37:16 PM: User git error while checking for ref refs/heads/master
9:37:16 PM: Failing build: Failed to prepare repo

I have not encountered this error before in this context. Build settings are as follows, and have never been touched by me:

Runtime: Not set
Base directory: /
Package directory: Not set
Build command: Not set
Publish directory: Not set
Functions directory: netlify/functions
Deploy log visibility: Logs are public
Build status: Active

I am not sure if it’s relevant (since the git pushes went through in any case), but I checked that I can successfully run ssh -T git@github.com in terminal.

2 Likes

I am also experiencing deployment issues with an error of:
git@github.com: Permission denied (publickey).

I have not changed any of my Github or Netlify settings. I have relinked Github as a connected account in my Netlify profile, just in case, but the problem remains.

2 Likes

Same issue here. Any help appreciate

2 Likes

I had the same problem and solved it by linking the GitHub repo again (choose “link another repository” and choose the one that was already linked). Now, everything works again!

Deploys → Deploy Settings → Manage Repository → Link to a different repository, then go through all the follow-up steps.

2 Likes

@rindPHI Thanks, this solved it for me!

@MatthewDiamant You mentioned this did not work for you?

That worked, thanks!
I relinked Githuib, but didn’t relink the actual repo, even though it said the repo was still linked.

1 Like