Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

git hook with shh config

hello , I connect in digital ocean server with this ssh config -

Host my_host
User root
Port 22
Hostname 123.123.111.222
IdentityFile ~/.ssh/digital_ocean
TCPKeepAlive yes
IdentitiesOnly yes

then In my machine I make the command to connect to the host -

ssh my_host

then it will connect .

but , now I have created a git hook . I need to connect with my hook -

git remote add production  ssh://[email protected]/var/repo/app.git

then I manke the command -

git push production 

And will not connect , becose my server will ask for the ssh key . there is any way to associate the ssh config to the git hook ? do something like that -

ADD SSH CONFIG TO PRODUCTION -
Host my_host_production
User root
Port 22
Hostname 123.123.111.222/var/repo/app.git
IdentityFile ~/.ssh/digital_ocean
TCPKeepAlive yes
IdentitiesOnly yes

and then the hook -

git remote add production  my_host_production

then git push production

there is any way to do something like that ?

0 likes
0 replies

Please or to participate in this conversation.