automatically remote deploy from gogs inside docker

413 views Asked by At

We have a gogs server installed with docker in machine gitbase. Also, we have a frontend server as web server.

What I want to do is to write code in my local machine, push to gitbase. And then automatically deploy the code to frontend server using git hooks.

In the git hooks, I wrote post-receive hook which ssh into the frontend server to git clone the repo. But it shows Host key verification failed error.

I have passwordless login to frontend from gitbase using username root. So my guess is that gogs inside docker try to ssh using a different username, how can I find what username it used? Or is there other way to do the remote deployment?

Thanks.

1

There are 1 answers

0
user1412192 On

It depends on which user one has created while setting up the Gogs server. I doubt user would be anything but root. Eg., git or gogs.

Easy way to find this out is to observe the ssh clone url. It generally have format like user@server:path.

Try configure ssh script using this user.

BTW: I would recommend using post-update ssh hook instead of post-receive.