简体   繁体   中英

How can I configure Server-Side custom_hooks in GitLab?

I've tried below approach and it works fine. However, it just commits and pushes from my local to git then it will push to the remote server.

git remote add origin https://code.company.com/autodeployment/fiver.git
git remote set-url --add --push origin https://code.company.com/autodeployment/fiver.git
git remote set-url --add --push origin fiver@server01.company.com:/var/fiver/fiver.git

I wanted to commit and push from my local to Git and Git should have a custom_hook where the remote server will auto-fetch or the Git will auto push to the remote server.

Don't bother with hooks for this. Simply define a push mirror. This is available in CE version if you wonder (only pull mirrors need the EE version).

Go to your repo > settings > repository > mirroring settings and just follow the guide.

The only very small drawback I have experienced so far is that there is a 5 minutes limit between pushes. But it is rarely a blocker in real life as you can still push manually to all your remotes if you really need to.

Reference: https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM