In my environment, we did it slightly differently.  My environment was this:

/var/rancid/rancid is a working local git checkout
/var/rancid/git/rancid is the local git 'master'
/var/rancid/git/rancid/hooks/post-receive has what you're looking for:
user@host# cat post-receive
#!/bin/bash


# ---------------------------------------------
# keep remote git copy up to date
# ---------------------------------------------

/usr/bin/git push -u <REMOTE_GIT_SERVER_NAME> <REMOTE_GIT_REPO_NAME>

To make that work, you must run this command to add the remote:

     git remote add <REMOTE_GIT_SERVER> <URL_TO_REPO>

Docs for the remote add are at 
https://help.github.com/articles/adding-a-remote/.

--Chris



Chris Gauthier Senior Network Engineer | comScore, Inc.
t +1 (503) 331-2704 |
cgauth...@comscore.com
317 SW Alder Street, Suite 700 | Portland, OR 97204  United States
comscore.com
​​​This e-mail (including any attachments) may contain information that is 
private, confidential, or protected by attorney-client or other privilege. If 
you received this e-mail in error, please delete it from your system and notify 
sender.
-----Original Message-----
From: heasley <h...@shrubbery.net>
Date: Thursday, January 11, 2018 at 9:53 AM
To: "Gauthier, Chris" <cgauth...@comscore.com>
Cc: "rancid-discuss@shrubbery.net" <rancid-discuss@shrubbery.net>
Subject: Re: [rancid] Howto setup Rancid with Git on Debian?

Thu, Jan 11, 2018 at 03:20:20PM +0000, Gauthier, Chris:
> As for the Git part, rancid uses a local git server that it creates the 
> folder structure for.  Each rancid group is its gets own Git repo.  The key 
> is really the rancid config file.  Set RCSSYS=”git” and it will do the heavy 
> lifting.  If you need the stuff to go to a remote repo, then you will need to 
> make the local Git do blind commits to the remote repo.  That’s something one 
> of my server admins took care of, so I’m not sure exactly how he did it.

Add a remote to a given rancid group: 
https://help.github.com/articles/adding-a-remote/
add to the rancid-run cronjob, a 'git push newremote'

        cd ~rancid/group
        git remote add foo giturl
        ... rancid-run; cd ~rancid/group; git push foo

add a second push destination (remote should not require auth) to origin
and rancid will push to it each run.
        cd ~rancid/group
        git remote add foo giturl
        git remote set-url --add --push origin `git remote get-url --push 
origin`
        git remote set-url --add --push origin `git remote get-url --push foo`





_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss

Reply via email to