Skip to content

Instantly share code, notes, and snippets.

@hfm
Created March 23, 2018 07:48
Show Gist options
  • Select an option

  • Save hfm/40f15d49512668a40ee4b0cd0e7731d8 to your computer and use it in GitHub Desktop.

Select an option

Save hfm/40f15d49512668a40ee4b0cd0e7731d8 to your computer and use it in GitHub Desktop.

Revisions

  1. hfm created this gist Mar 23, 2018.
    26 changes: 26 additions & 0 deletions hub_fork.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    まず、`$HOME/.gitconfig``[hub]` の host に GHE のホストを追加するために、以下のコマンドを実行します。

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

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

    ```ini
    [hub]
    host = your.ghe.com
    ```

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

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

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

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