LoginSignup
4
0

More than 5 years have passed since last update.

hubのアンインストールで手こずった話

Last updated at Posted at 2017-09-20

事故紹介

とある会社で、 GitHub Enterprise に日報を上げてる @amooon だよ
プルリクとか自動化させたいなーと思い、やらかしたことをメモする

hub っていうの便利そ〜

コマンドでプルリクを出すことができるらしい hub というのを見つけ、インストール&設定
当方、 zsh を使用

console
$ brew install hub
$ echo 'function git(){hub "$@"}' >> ~/.zshrc
$ source ~/.zshrc

「わーい、これでいろいろ自動にできるぞ〜!」

アンインストールしよう

便利だなーと一瞬思っていたところ、 GitHub Enterprise だと、いろいろややこしいことが判明したので、
後日やろうと思い、 hub を一旦アンインストールすることにした

console
$ brew uninstall hub
$ vim ~/.zshrc
$ # 'function git(){hub "$@"}' を消す
$ source ~/.zshrc

さーて戻った戻った
ところがどっこい

console
$ git
git: command not found: hub

git コマンドが使えなくなったでござる
あれれ〜?となった

console
$ which git
git () {
    hub "$@"
}

消したはずのものが、何故か残っていた
このあといろいろしても治らず

解決方法(?)

.zshrc に書いたものが、どこかしらに反映されてしまうのであれば、
上書きしてしまえばいいと思い、試した

console
$ echo 'function git(){git "$@"}' >> ~/.zshrc
$ source ~/.zshrc

$ vim ~/.zshrc
$ # 'function git(){git "$@"}' を消す
$ source ~/.zshrc

$ brew install git

これで治った。逆にこの手順じゃないと治らない
この手順をしなければいけない理由が全く分からないまま、解決した
どこにも情報がないように思えたので 初Qiita

4
0
4

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
4
0