gitの最近のブログ記事
リモートブランチを追跡するブランチを作成する。
git branch [branch] [remotename]/[branch]
git checkout -b [branch] [remotename]/[branch]例:origin/serverfix を追跡するローカルブランチsfを作成してチェックアウト。
$ git checkout -b sf origin/serverfix
Git Book - Tracking Branches
Pro Git - Pro Git 3.5 Git のブランチ機能 リモートブランチ
カテゴリー:
gitosisを使っていたが、gitosisではブランチごとにパーミッションを設定できない。
gitoliteではブランチごとにパーミッションを設定できるらしいので、インストール、設定してみた。
インストール
http://sitaramc.github.com/gitolite/install.html の、root methodで行った。設定
http://sitaramc.github.com/gitolite/admin.html ユーザ、レポジトリの追加方法、パーミッションの設定など。感想
gitoliteはよい!gitosisではできないブランチごとのパーミッション設定が可能だし、設定ファイルもgitosisよりきれいで分かりやすい。(特にレポジトリが多くなった場合。)
また、ドキュメントも充実していて分かりやすいので、インストールや設定が楽だった。
その他
- /etc/ssh/sshd_config にAllowUsersを設定している場合は、gitoliteユーザを追加すること。
- gitoliteで管理しているレポジトリを Redmineのレポジトリブラウザで使用する場合、パーミッションに注意。
gitoliteのデフォルトでは、push時にファイルのパーミッションが600になるので、Redmineの実行ユーザがgitoliteユーザと異なると、
redmine fatal: Failed to resolve HEAD as a valid ref.
というエラーになる。
push時に作成されるファイルのパーミッションを変更するには、 gitoliteユーザの.gitolite.rcを以下のように編集する。
#$REPO_UMASK = 0077; # gets you 'rwx------' #$REPO_UMASK = 0027; # gets you 'rwxr-x---' $REPO_UMASK = 0022; # gets you 'rwxr-xr-x'
Redmine - redmine read git repo without having to reset - Redmine
カテゴリー:
CentOSのyumにはbash-completionがないので、ソースからインストールした。
Bash-Completion
から、最新のソースをダウンロードしてインストール。
$ tar xjvf bash-completion-1.3.tar.bz2 $ cd bash-completion-1.3 $ ./configure $ make $ sudo make install~/.bashrc
# bash_completion
BASH_COMPLETION=/usr/local/etc/bash_completion
BASH_COMPLETION_DIR=/usr/local/etc/bash_completion.d
BASH_COMPLETION_COMPAT_DIR=/usr/local/etc/bash_completion.d
if [ -f /usr/local/etc/bash_completion ]; then
. /usr/local/etc/bash_completion
fi
Gitのbash_completionは、Gitのソースの/contrib/completion/git-completion.bash、
Subversionのbash_completionは、Subversionのソースの/tools/client-side/bash_completion
にあるので、/usr/local/etc/bash_completion.d/ にそれぞれgit、svnという名前で保存すればよい。
カテゴリー:
git+sshでデフォルト(id_rsa)以外のキーファイルを指定したい場合 - yukke.org Diary
~/.ssh/configでgitで使用するHOSTを登録してIdentityFileを指定すればよい。
例
~/.ssh/config
Host Foo
HostName example.com
User foo
IndentityFIle ~/.ssh/id_other
$ git remote add origin user@Foo:/your/repository.git
カテゴリー:
git svn status - showing changes that are not committed to svn - Stack Overflow
リモートブランチを最新に更新しておく。$ git fetch $ git svn fetchリモートブランチを確認。
$ git branch -a * master remotes/origin/master remotes/svn/tags/RELEASE_20101022 remotes/svn/tags/RELEASE_20101025 remotes/svn/trunk差分を表示。
$ git diff remotes/origin/master差分を表示(簡易表示)
$ git diff --name-status remotes/origin/master差分を表示(subversionレポジトリ)
$ git diff --name-status remotes/svn/trunk


最近のコメント