using git with web services and fetch_updates
Added by Sean Davis almost 14 years ago
I would like to use web services to update my local git repository after each receive by the server. As a test, though, I have been calling:
curl "http://server.example.gov/sys/fetch_changesets?key=API_KEY"
This results in the log in:
Processing SysController#fetch_changesets (for 128.231.2.3 at 2011-02-05 10:24:42) [GET] Parameters: {"key"=>"API_KEY"} Completed in 7095ms (View: 1, DB: 70) | 200 OK [http://.....]
However, I see no change in my git repository view. Running:
ruby script/runner "Repository.fetch_changesets" -e production
Also does not produce a change. The only thing that I can get to work is:
#!/bin/bash for d in /Users/sdavis/redmine/git_repositories/* do cd $d /usr/local/bin/git fetch /usr/local/bin/git reset --soft refs/remotes/origin/master cd .. done
running as a cron script. Any suggestions as to whether or not the web service approach should be expected to work? It would be nice to just add the curl call to a post-receive hook.
Thanks,
Sean
Replies (2)
RE: using git with web services and fetch_updates - Added by Felix Schäfer almost 14 years ago
Sean Davis wrote:
Any suggestions as to whether or not the web service approach should be expected to work? It would be nice to just add the curl call to a post-receive hook.
The /sys/fetch_changesets
call only tells redmine to update the view it has of the repository configured for the project(s). In case of a git repository, it has to be local, but redmine won't refresh the local repository, sorry.
The best way to achieve what you are looking for would be to add a post-receive hook to the repo you are pushing to that would in turn push to the repo on the redmine box, and then have a post-receive on the redmine-box repo callin the /sys/fetch_changesets
.
RE: using git with web services and fetch_updates - Added by Sean Davis almost 14 years ago
The best way to achieve what you are looking for would be to add a post-receive hook to the repo you are pushing to that would in turn push to the repo on the redmine box, and then have a post-receive on the redmine-box repo callin the /sys/fetch_changesets.
This makes perfect sense. In this case, my local repo is behind a firewall and the remote repo is on github. So, I will have gone the route of a cron job to do the fetch and reset locally.
Thanks,
Sean