Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@mazgi

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

1
Help us understand the problem. What is going on with this article?
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
mazgi
メモを書きます
dena_coltd
    Delight and Impact the World

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?