39
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RedmineとGitの連携メモ

Last updated at Posted at 2014-05-23
  • OS: ubuntu14.04lts
  • ベアリポジトリは/home/user/git/public/barerepository.git

Gitのインストール

$sudo aptitude install git

gitをインストール.

そのほかは基本的なgitコマンドまとめを参考に.

Redmineの設定

図1 Redmine>管理>設定>リポジトリ
Screenshot from 2014-05-23 18:43:39.png

APIキーを生成しておく.


図2 Redmine>プロジェクト>プロジェクト名>設定>新しいリポジトリ
Screenshot from 2014-05-23 18:53:35.png
Gitと連携させるベアリポジトリを設定する.
識別子はファイル名とかわかりやすいように,メインリポジトリや最新コミットを表示させるかどうかはオプションで.

Gitのhooksを利用する

/home/user/git/public/barerepository.git/hooks/post-reseive
# !/bin/sh
WGET="/usr/bin/wget"
REDMINE_URL_BASE="http://localhost/redmine/"
REDMINE_REPOS_API_KEY=redmine_api_key
REDMINE_PROJECT_ID=redmine_project_id
 
echo "redmine update"
RESPONSE=$($WGET "${REDMINE_URL_BASE}sys/fetch_changesets?key=${REDMINE_REPOS_API_KEY}&id=${REDMINE_PROJECT_ID}")
echo $RESPONSE
exit 0

ベアリポジトリのhooksの下にpost-receiveを作成する.

$sudo chmod 775 /home/user/git/public/barerepository.git/hooks/post-reseive

post-receiveの権限を書き換える.

これにより,ベアリポジトリにpushされたときにRedmineが自動で更新されるようになる.

ちなみに

図1のように参照用キーワードを*に変えておけば,チケット番号をコミットメッセージに書いてあげるだけでチケットと紐付けされる.

$git commit -a -m "これは練習だよ! #1"      //こんな具合に


## 参考サイト * [[git][redmine] pushした際にRedmine側の「リポジトリ」の情報も更新する](http://blog.iss.ms/2011/08/30/125938)
39
45
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
39
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?