Search code examples
phplaravelgithubsshforge

Laravel Forge:Struggling to deploy new changes to a specific website on a server Laravel Forge


I am currently very new to forge and need to work on existing websites deployed on forge. The issue I am having is not being able to deploy changes to one project while I have no problem pushing changes to the other existing websites running on the same server. This is the error I got:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

The other thing I noticed is that the latest changes to the repo were back in 2021...

I have seen a couple of solutions on here that I tried:

1- Added deployment key to the repo. It was already in use. My device's public ssh key is already added to the server and I don't have any trouble maintaining other older websites in the same server.

2- I tried sshing into the server and make sure my credentials were set up correctly. (git config ...)
3- set the remote url just in case it was the wrong one.

4-Made sure there were no ssh keys in an old developer account within the organization.

5-Used ssh-agent to generate a new key from the server and added it to my account.

6-Added deployment key to repo..It said the key is already in use.

Considering this is an issue with one repo I am starting to winder if the issue is beyond ssh...


Solution

  • First, you can try and set/export the environment variable GIT_SSH_COMMAND to ssh -Tv in order to see which key is used during your deployment process.

    Second, for testing, make sure to use a key created without passphrase (not encrypted), meaning ssh-agent should not be involved/needed at any point.