Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

最近数年ぶりに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両方とも参照できるようになった。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away