LoginSignup
2
1

More than 5 years have passed since last update.

GitHub.com/GitHub Enterprise両方でhubコマンドを使う(ghq+direnv)

Posted at

最近数年ぶりにhubを使っている。
以前使っていた時から扱うGitHubリポジトリ数が数倍に増えた今は便利だなーと思う。

で、勤務先ではGitHub Enterpriseを使っているので「hubコマンドをGitHubとGitHub Enterprise両方で使いたい!」という欲求を満たすことにした。

hubコマンドに加えてお世話になるのは以下。

ディレクトリツリーは ghq にお任せしているのでこのようになる。

$ tree -L 2 .
(ghq root)
├── com.mazgi
│   └── Untitled.mov
├── github.com
│   ├── mazgi
│   ├── mazgi-sandbox
│   └── sbtenv
└── github-enterprise.example.com
    ├── AI
    ├── hidenori-matsuki
    └── mazgi

そして $(ghq root)/github-enterprise.example.com/.envrc で次のように $GITHUB_HOST をexportする。
see: https://hub.github.com/hub.1.html

cat $(ghq root)/github-enterprise.example.com/.envrc
# vim: set filetype=bash
export GITHUB_HOST="github-enterprise.example.com"

これでhubコマンドがGitHub.com/GitHub Enterprise両方とも参照できるようになった。

2
1
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
2
1