0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git commandが効かなくなった

0
Posted at

急にgitが使えなくなった

Visual code studioでcommitをしようとしたら、「gitをinstallしてください」みたいな文章を出された。Macだからgitは標準で入ってるだろと思いながらも

$ git --version

を叩いてみると、

Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

んー。Xcodeのライセンスに同意しろって言われた。

OS Xをupdateした後に初めて再起動したから?
原因がわからなかったが、Xcode開いて、利用規約に同意すると直る。

Xcode起動するのめんどくさい問題

$ sudo xcrun cc

って打ってspace連打して最後に

$ agree

その後

$ git --version

で確認

git version 2.8.4 (Apple Git-73)

これでまたgitが使えるようになりました。

Homebrewのgitに切り替える

このままだと、なんかのひょうしにまたライセンスに同意しろって言われそうなので、Homebrewのgitに切り替えることにした。

$ brew list

でHomebrewでinstallしたものを確認。
gitがなかったのでinstallする

$ brew install git

installが終わったら

$ vi ~/.bash_profile

で

$ export PATH="/usr/local/Cellar/git/2.5.0/bin:$PATH"

pathを通す

最後にTerminalを再起動して

$ git --version
  git version 2.8.2

homebrew側のgitに切り替えられた。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?