Closed GlennM closed 4 years ago
Just use deploy keys. This is most easy to go solution and should work 100% in implemented correctly. Don't rely on agent forwarding, just allow your server to pull changes from git.
Thanks for your quick reply @antonmedv ! Unfortunately, I think there's still some confusion about the deployment keys. I've tried several combinations, but have been unable to get it working.
To be specific:
ssh-keygen
on my local machine or on the server I'm trying to push the code to?id_rsa_gitlab
) or do I need to adjust something in that case?before_script
part from the GitLab docs to my .gitlab-ci.yml
(job-specific, not global before_script).I've tried to follow the GitLab instructions.
šš»
When generating the SSH key pair, I am not quite sure what email address to use. Or doesn't that matter?
Any email. Keys are just files.
Should I run ssh-keygen on my local machine or on the server I'm trying to push the code to?
Doesn't matter. Make sure git using them on machine which trying to access git server.
Will it cause any issues if I have a different name for the keypair (e.g. id_rsa_gitlab) or do I need to adjust something in that case?
No. As long as your git is using them.
I added the private key as a private variable to GitLab project
Okay. But why?
I added the public key as a deployment key to GitLab project
Okay. But why?
I added the before_script part from the GitLab docs to my .gitlab-ci.yml (job-specific, not global before_script).
This is releated only for gitlab, can help here.
Thanks, but I still don't get it working.
Result
pwd
task mentioned on the deployer docs).However, when I'm trying to deploy, I get an error, which I think has to do with permissions for GitLab, as the error occurs specifically when trying to perform deploy:update_code
.
Error:
Cloning into '[PATH]/releases/1'...
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Make sure what user which connect from gitlab to your server uses same keys.
Thanks for your help @antonmedv, I got it working now.
Probably it was a combination of multiple factors, but the root cause seems to be that dep init
put a wrong repository url in the deploy.php file (config related, not a bug in deployer package).
Hi,
I'm trying to implement deployer for the deployment stage of GitLab CI. Unfortunately, I've been unable to get it fully working.
Setup
Issue
I've been seeing various error messages (e.g. TTY error, hopefully solved by disabling
git_tty
option).The error I am unable to solve is:
(I've replaced some specific info with general info, see the
[]
).I did several attempts, e.g.
Question
Is there someone who could point me to the right direction to get my setup with GitLab and push to server working?