Skip to content

Instantly share code, notes, and snippets.

@hfm
Created March 23, 2018 07:48
Show Gist options
  • Save hfm/40f15d49512668a40ee4b0cd0e7731d8 to your computer and use it in GitHub Desktop.
Save hfm/40f15d49512668a40ee4b0cd0e7731d8 to your computer and use it in GitHub Desktop.
`hub` の fork サブコマンドは GitHub Enterprise との併用(マルチリモート)でも使えます。その手順を書いておきます。

まず、$HOME/.gitconfig[hub] の host に GHE のホストを追加するために、以下のコマンドを実行します。

git config --global --add hub.host your.ghe.com

実行後、 $HOME/.gitconfig に GHE のホストが登録されます。

[hub]
        host = your.ghe.com

基本はコレだけ。GHE のリポジトリを clone し、 git fork を打てば GHE 側の自分のところへ fork 出来るようになっています。

以降、 git create でリポジトリをリモートに作ろうとしたときに、

$ git create
Select host:
 1. your.ghe.com
 2. github.com
>

こういう風に質問もしてくれるようになります。便利。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment