Private Github Repositories with Envoy

和自甴很熟 提交于 2021-02-11 14:35:00

问题


Anybody has any problems deploying with Laravel's envoy when using private Github repos?

When manually cloning my repo from the production server, the ssh key seems to be accessible but when using Envoy, I always get a "Permission denied (publickey) error.

Envoy problem

Thanks


回答1:


It is probably because the ssh key on your remote server requires a password.

If you change the Envoy.blade.php to perform some other task you should be able to establish whether you are connecting to your remote correctly.

@servers(['web' => 'user@domain.com'])

@task('deploy')
    cd /path/to/site
    git status
@endtask

Should return something like:

[user@domain.com]: On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

If you are connecting using a Mac or Linux you probably don't have to enter your password because your terminal is using ssh-agent which silently handles your authentication.

Wikipedia article on ssh-agent

When connecting over ssh, ssh-agent isn't running and the script is being prompted for a password which is where it is failing.

To get around this you could to generate a new key on the remote machine that doesn't use a password.

If you want to restrict the ssh key to a single repository on GitHub have a look at deploy keys




回答2:


You need to pass the -A (as per the man page it - Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file) in you ssh string.

You will also need add your ssh key for agent forwarding (on the machine which can access the git remote which I assume be your localhost)

ssh-add -K ~/.ssh/your_private_key

Something like this

@servers(['web' => '-A user@domain.com'])

@task('deploy')
 cd /path/to/site
 git status
@endtask

Git remote commands should now work.



来源:https://stackoverflow.com/questions/28913682/private-github-repositories-with-envoy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!