経緯
https://github.com/nvie/gitflow/wiki/Linux のOther Linuxesを参考にインストールしようとしたが、何故かダウンロードで失敗。
原因
http://watercelldev.hatenablog.jp/entry/2014/05/14/150343
が参考になりました。
GithubのrawファイルURLが変わった影響でうまくcurlでダウンロードできていませんでした。
対応
インストーラのダウンロード
curl -OL https://raw.githubusercontent.com/nvie/gitflow/develop/contrib/gitflow-installer.sh
※raw.github.comでなくraw.githubusercontent.comになっているところがポイント
インストーラスクリプトを修正
if [ -z "$REPO_HOME" ] ; then
- REPO_HOME="http://github.com/nvie/gitflow.git"
+ REPO_HOME="https://github.com/nvie/gitflow.git"
fi
※httpになっている箇所をhttpsに修正する
インストーラスクリプトを実行
bash gitflow-installer.sh
実行して下記のように表示されればインストールは成功。
[root@localhost src]# bash gitflow-installer.sh
### gitflow no-make installer ###
Installing git-flow to /usr/local/bin
Using existing repo: gitflow
Updating submodules
Initialized empty Git repository in /usr/local/src/gitflow/shFlags/.git/
remote: Counting objects: 454, done.
remote: Total 454 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (454/454), 130.91 KiB | 111 KiB/s, done.
Resolving deltas: 100% (337/337), done.
Submodule path 'shFlags': checked out '2fb06af13de884e9680f14a00c82e52a67c867f1'
`gitflow/git-flow' -> `/usr/local/bin/git-flow'
`gitflow/git-flow-init' -> `/usr/local/bin/git-flow-init'
`gitflow/git-flow-feature' -> `/usr/local/bin/git-flow-feature'
`gitflow/git-flow-hotfix' -> `/usr/local/bin/git-flow-hotfix'
`gitflow/git-flow-release' -> `/usr/local/bin/git-flow-release'
`gitflow/git-flow-support' -> `/usr/local/bin/git-flow-support'
`gitflow/git-flow-version' -> `/usr/local/bin/git-flow-version'
`gitflow/gitflow-common' -> `/usr/local/bin/gitflow-common'
`gitflow/gitflow-shFlags' -> `/usr/local/bin/gitflow-shFlags'
git flowの動作確認
git flow
実行して下記のような表示がされたら動作成功です。
[root@localhost test]# git flow
usage: git flow <subcommand>
Available subcommands are:
init Initialize a new git repo with support for the branching model.
feature Manage your feature branches.
release Manage your release branches.
hotfix Manage your hotfix branches.
support Manage your support branches.
version Shows version information.
Try 'git flow <subcommand> help' for details.
備考
ちなみにインストーラスクリプトを実行した際に最初下記のようなメッセージが出て失敗しました。
[root@localhost src]# bash gitflow-installer.sh
### gitflow no-make installer ###
Installing git-flow to /usr/local/bin
Cloning repo from GitHub to gitflow
Initialized empty Git repository in /usr/local/src/gitflow/.git/
remote: Counting objects: 1407, done.
Receiving objects: 100% (1407/1407), 623.29 KiB | 300 KiB/s, done.
remote: Total 1407 (delta 0), reused 0 (delta 0)
Resolving deltas: 100% (689/689), done.
Updating submodules
Submodule 'shFlags' (git://github.com/nvie/shFlags.git) registered for path 'shFlags'
Initialized empty Git repository in /usr/local/src/gitflow/shFlags/.git/
fatal: Unable to look up github.com (port 9418) (No address associated with hostname)
Clone of 'git://github.com/nvie/shFlags.git' into submodule path 'shFlags' failed
`gitflow/git-flow' -> `/usr/local/bin/git-flow'
`gitflow/git-flow-init' -> `/usr/local/bin/git-flow-init'
`gitflow/git-flow-feature' -> `/usr/local/bin/git-flow-feature'
`gitflow/git-flow-hotfix' -> `/usr/local/bin/git-flow-hotfix'
`gitflow/git-flow-release' -> `/usr/local/bin/git-flow-release'
`gitflow/git-flow-support' -> `/usr/local/bin/git-flow-support'
`gitflow/git-flow-version' -> `/usr/local/bin/git-flow-version'
`gitflow/gitflow-common' -> `/usr/local/bin/gitflow-common'
install: cannot stat `gitflow/gitflow-shFlags': そのようなファイルやディレクトリはありません
メッセージを見る限りgit-flowのサブモジュールshFlagsの更新のところで失敗していました。
スクリプト内で行っていることと同様にgit-flowをcloneして、submoduleをinit,updateしても正常に更新され、?となり一度uninstallしてから再度実行すると正常にインストールが完了。
インストールに失敗した際は以下のように一度アンインストールして再度インストールを試みると成功するかもしれません。
bash gitflow-installer.sh uninstall