git clone実行時にエラー「fatal: could not create work tree dir ‘xxx’.: ????????」が発生した場合の対処法

  • 作成日 2020.07.02
  • 更新日 2020.07.17
  • git
git clone実行時にエラー「fatal: could not create work tree dir ‘xxx’.: ????????」が発生した場合の対処法

git clone実行時にエラー「fatal: could not create work tree dir ‘xxx’.: ????????」が発生したので、原因と対処法を記述してます。

環境

  • OS centos7.7.1908
  • git 1.8.3.1

エラー全文

git clone実行時に発生

git clone https://github.com/cezerin/cezerin.git cezerin

<出力結果>
fatal: could not create work tree dir 'cezerin'.: ????????

原因

文字化けして「?????」になっていてわかりずらいですが、cloneするディレクトリの権限の問題のよう。

対処法

ディレクトリに権限を付与する

sudo chown username /対象ディレクトリ

または、sudoを付けて実行する

sudo git clone https://github.com/cezerin/cezerin.git cezerin