Disabling a port before pressing git

I currently have a VPS that I use as a git server.

This VPS is protected by port disconnection , which means that I have to send some packets to specific ports before I can connect to port 22 (used for SSH).

I thought I could configure a git pre-push hook that triggers a port failure so that git can connect to the server and push.

Unfortunately, this hook does not work. Here is how I did it:

vim .git/hooks/pre-push

echo "Foo"
[my port knocking command which works perfectly fine]
echo "Bar"

chmod +x .git/hooks/pre-push

When git push starts , Foo or Bar is displayed. Nothing happens.

I assume git is trying to connect to the remote server before by doing a preliminary click.

?

, - :)

+4
1

git pre-push , git , , , , .

git config core.sshCommand 'knock && ssh' . , . git config core.sshCommand GIT_SSHCOMMAND.

+3

Source: https://habr.com/ru/post/1670524/


All Articles