I am currently struggling with using the gh-pages plugin. I am using Gitea for the source code for my Hugo site, it builds without an issue, but when it comes to using gh-pages plugin it wont push the updated site contents to it.
The error I get is:
Load key "/root/.ssh/id_rsa": invalid format
email@example.com: Permission denied (publickey).
fatal: Could not read from remote repository.
In this example you are setting the secret to the string literal value "~/.ssh/id_rsa" which is why you are getting the invalid format error. If you want to read the secret from local file you need to prefix the path with the @ symbol, for example, --data @/home/.ssh/id_rsa
We know git is using your key because you previously received an invalid format error (so we can rule out secret not being injected). We see git now returns a permission denied error. This would generally imply the ssh key does not have the necessary level of access, which in this case, is push access to the repository.
Is it possible your ssh key has read access to the repository, but lacks push access? You mention you tested locally and you were able to connect to GitHub, however, it was unclear to me whether you tested pushing or pulling. I believe when you configure a key in GitHub it is read only by default (see below screenshot). This would explain the Permission Denied error, but this is my best guess given the limited information I have.