Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions GitAutoDeploy.conf.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[{
"url": "https://github.com/logsol/Test-Repo",
"path": "/home/logsol/projects/Test-Repo",
"gitcmd": "git fetch && git reset --hard origin/master && git clean -df && git checkout master",
"deploy": "echo deploying"
},
{
Expand Down
9 changes: 8 additions & 1 deletion GitAutoDeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ def respond(self, code):
self.end_headers()

def fetch(self, path):
gitcmd = 'git fetch'
config = self.getConfig()
for repository in config['repositories']:
if(repository['path'] == path):
if 'gitcmd' in repository:
gitcmd = repository['gitcmd']
break
if(not self.quiet):
print "\nPost push request received"
print 'Updating ' + path
call(['cd "' + path + '" && git fetch'], shell=True)
call(['cd "' + path + '" && ' + gitcmd], shell=True)

def deploy(self, path):
config = self.getConfig()
Expand Down
2 changes: 1 addition & 1 deletion README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When someone pushes changes into Github, it sends a json file to the service hoo
It contains information about the repository that was updated.

All it really does is match the repository urls to your local repository paths in the config file,
move there and run "git fetch".
move there and run your desired git command.

Additionally it runs a deploy bash command that you can add to the config file optionally.
Make sure that you start the server as the user that is allowed to pull from the github repository.