Created
March 16, 2015 13:01
-
-
Save aqlx86/81abe28eae9b362c86cc to your computer and use it in GitHub Desktop.
git post-receive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # remote server domain.com | |
| # create deploy directory | |
| mkdir /www/app/ | |
| # create repo dir | |
| mkdir repo.git && cd repo.git | |
| # init git repo | |
| git init --bare | |
| # modify repo config | |
| vi config | |
| # config content | |
| [core] | |
| repositoryformatversion = 0 | |
| filemode = true | |
| bare = false | |
| worktree = /www/app | |
| [receive] | |
| denycurrentbranch = ignore | |
| # create post-receive hook | |
| vi hooks/post-receive | |
| # hook content, change source branch | |
| #!/bin/sh | |
| git checkout -f <source-branch> | |
| # chmod hook | |
| chmod +x hooks/post-receive | |
| # client side | |
| git remote add staging git@domain.com:repo.git | |
| git push staging <source-branch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment