Problem with ssh-key / post receive


#1

Hello,

i’m using deployer on the Server with gitea. The Idea is, a post-receive calls the deployer for the repo. On the console with the gitea-user the deployer runs, no errors. All ssh-keys are added to the ssh-agent and he is loaded from a script in the .bash_profile. The post receive runs with the same user, but if i push, i get this,

remote:   [Deployer\Exception\RuntimeException]    
remote:   The command "echo $0" failed.            
remote:   Exit Code: -1 (Unknown error)            
remote:   Host Name: release                       
remote:   ================                         
remote:   Permission denied, please try again.     
remote:   Permission denied, please try again.     
remote:   Permission denied (publickey,password).  

#2

Coud you post your post-receive script here? Cannot find the reason.


#3

Damn! :smiley:

There only two lines in my post-receive, he only starts the deployer. But i found the reason. I have add the keys to ssh-agent. The ssh-agent starts with a script in the ./bash_profile. BUT i have checked the post-receive, there is no ssh-agent running, so he didn’t know the keys… I’m not sure how to “fetch” the ssh-agent :confused:


#4

Finally, i found a solution, with this posting about the ssh-agent,

http://rabexc.org/posts/pitfalls-of-ssh-agents

I run a script to get the ssh-agent that started with the bash. The Problem was the ssh-agent that was not running. It makes sense, because gitea runs as a Service.

But i’m not really satisfied with this, it feels a little bit hacky.


#5

it’s a service start sequence problem? maybe you should let gitea depends on ssh-agent which I’m not familiar with.