Skip to content

Instantly share code, notes, and snippets.

@gwpl
Created April 27, 2023 18:51
Show Gist options
  • Save gwpl/191d2afeb6a26537dde8aae7afc846ec to your computer and use it in GitHub Desktop.
Save gwpl/191d2afeb6a26537dde8aae7afc846ec to your computer and use it in GitHub Desktop.
Automatically pushing main branch to multiple repositories after each commit
# cat .git/hooks/post-commit # <= change this file in your repo to automatiicaly execute after each commit
#!/bin/bash
cd /path/to/your/repo
git push gitlab master && git push github master && git push anotherserver master
# You may want to add your different remotes using:
# git remote add REMOTENAME git@server.domain:group/project.git #this is ssh example
# (and REMOTENAME above was gitlab, github, anotherserver...)
@gwpl
Copy link
Author

gwpl commented Apr 27, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment