On Thu, 2023-08-24 at 22:24 +0000, Russell L. Harris wrote:
> #!/bin/bash
> # post-commit
> # 2023.08.24 2200gmt
> 
> ssh backup "git pull"
> exit 0
> 

You could omit the 'exit 0' so it returns the error code from the ssh
command, that way you'll get some feedback from failures to backup
which you would probably want to know about.

I'm also a bit confused about doing it this way. The usual workflow
with git is to 'push' to the remote repository, which is in fact what
you originally asked how to do.
 
As sothers pointed out, you push with the command 'git push' which you
could do in the hook script instead of 'ssh backup "git pull"'. But
whatever works for you I guess.

Note, if you ever edit commits then having an automated 'pull' or
'push' command will fail, as by default they will only do a fast-
forward operation. There are commandline options and config setups to
change this.

-- 
Tixy

Reply via email to