GitHub Enterprise - remote: Password authentication is not available for Git operations.
問題点
会社で GitHub Enterprise を使用していたところ、アクセスキーが期限切れになったためか、clone 時に次のようなエラーが発生した。
% git clone https://git.devkuma.com/devkuma/devkuma-hugo-blog.git
Cloning into 'devkuma-hugo-blog'...
remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://git.devkuma.com.com/settings/tokens or https://git.devkuma.com/settings/ssh
fatal: unable to access 'https://git.devkuma.com/devkuma/devkuma-hugo-blog.git/': The requested URL returned error: 403
上記の URL はセキュリティ上の理由で変更している。実際の URL は異なる。
解決方法
GitHub の Personal access tokens で新しいトークンを発行し、次のように入力して再度 clone した。
git clone https://<user-name>:<git-token>@<github-path.git>
実際にコマンドを実行すると次のようになる。
% git clone https://devkuma:ghp_eEREEeeQW2405408o1EQJIJegeiD332jtdfF@git.devkuma.com/devkuma/devkuma-hugo-blog.git
Cloning into 'devkuma-hugo-blog'...
remote: Enumerating objects: 2529, done.
remote: Counting objects: 100% (886/886), done.
remote: Compressing objects: 100% (347/347), done.
remote: Total 2529 (delta 246), reused 850 (delta 236), pack-reused 1643
Receiving objects: 100% (2529/2529), 311.62 KiB | 770.00 KiB/s, done.
Resolving deltas: 100% (763/763), done.
すでに clone 済みの場合は、次のように URL 設定だけを変更する方法もある。
git remote set-url origin https://devkuma:ghp_eEREEeeQW2405408o1EQJIJegeiD332jtdfF@git.devkuma.com/devkuma/devkuma-hugo-blog.git