koppen / redmine_github_hook

Allow your Redmine installation to be notified when changes have been pushed to a Github repository.
http://mentalized.net/journal/2009/08/03/redmine_plugin_github_hook/
MIT License
476 stars 116 forks source link

Github redirects to login page #89

Closed coolerUA closed 6 years ago

coolerUA commented 6 years ago

Environment: Redmine version 3.4.5.stable.17367 Ruby version 2.2.9-p480 (2017-12-15) [x86_64-linux] Rails version 4.2.8 Environment production Database adapter PostgreSQL SCM: Subversion 1.7.14 Git 1.8.3.1 Filesystem
Redmine plugins: a_common_libs 2.4.0 redmine_bootstrap_kit 0.2-devel redmine_checklists 3.1.11 redmine_ckeditor 1.1.5 redmine_custom_reports 0.1.5 redmine_emojibutton 0.4.1 redmine_github_hook 2.2.0 redmine_issue_tabs 1.3.0 redmine_lightbox2 0.4.3 redmine_people 1.3.2 that_email_log 0.0.1

When recieving events from github, getting:

Started POST "/github_hook?repository_id=XXXXXXXXXX" for 192.30.252.39 at 2018-06-21 14:37:53 +0300 Processing by GithubHookController#index as / Parameters: Current user: anonymous Completed 404 Not Found in 5ms (Views: 0.3ms | ActiveRecord: 1.1ms) Started GET "/" for XXX.XXX.XXX.XXX at 2018-06-21 14:38:01 +0300 Processing by WelcomeController#index as / Current user: anonymous Redirected to http://redmine.XXXXXX/login?back_url=http%3A%2F%2Fredmine.XXXXXX%2F Filter chain halted as :check_if_login_required rendered or redirected Completed 302 Found in 3ms (ActiveRecord: 0.7ms)

How to set up than github can push without redirect to login page? I suppose I can set authorization token in request url, but didn`t find how to do it in documentation.

koppen commented 6 years ago

Thanks for reporting this, much appreciated!

It looks like your log snippet contains two requests:

  1. POST "/github_hook?repository_id=XXXXXXXXXX" which ends up being a 404
  2. GET "/" which ends up with a 302

By the looks of things I am guessing Github Hook either cannot find a project to update. Please double check that your Redmine project identifier matches the repository name in GitHub, and if it doesn't specify it in your webhook URL using the project_id parameter.

coolerUA commented 6 years ago

Adding "project_id" parametr to webhook url seems fixed this.

Now I`m getting error

fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

I`ll try to fix it, seems this is on my side.

Thank you!

koppen commented 6 years ago

Looks like your repository hasn't been set up as a mirror/bare repo. See http://www.redmine.org/projects/redmine/wiki/HowTo_keep_in_sync_your_git_repository_for_redmine for details.