i have a local git server where i host files for a docker container with a blogging software (hexo). After a push to the local git server, i would like to automatically push the blog to gitlab.
This is the directory i push to the local git server:
hexo << to remote
- scaffolds << to remote
- source << to remote
- themes << to remote
- _config.yml << to remote
- package.json << to remote
- README.md << to remote
docker-compose.yml
Dockerfile
README.md
The directory hexo contains the blog. The lines that end with <<to remote
are thoose that i want to push to gitlab also.
Is this maybe possible with git webhooks, eg with a post-recieve hook on my local git server? If so, how? I coudnt find a good tutorial about it. I only want to push the folder hexo with its content to gitlab, not the whole repository.
Thanks in advance.
git webhooks, eg with a post-receive hook on my local git server?
Not exactly: a git webhook is not a post-receive hook.
post-receive
hook is a server-side hook , triggered by a git push to that same server. In your case, a post-receive
hook is what you need, if you have the control to the Git server you are pushing to.
In your server, make an executable /path/to/repo.git/hooks/post-receive
and do a git push
to gitlab there.
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.