git cloneしようとして、エラーになる。このURLを見ろって表示された。
sh-4.2$ sudo git clone https://github.com/専務のリポジトリ/ほげほげ.git
Cloning into 'ほげほげ'...
Username for 'https://github.com': shigeo@弊社ドメイン
Password for 'https://shigeo@弊社ドメイン@github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/専務のリポジトリ/ほげほげ.git/'
開いてみる。英語なのでGoogleの翻訳機能で翻訳した。
github.blog
あなたが今日する必要があること
今までGUIありのOSでZIPをダウンロードしてたので気付かなかった。そういえばこの件は専務が言ってたのを思い出した。
手順を探した。GitHubのものがあった。
docs.github.com
手順通り、Personal access tokensがあった。
[Generate new token]があるのでクリック。
手順と違ってパスワードを聞いてくる。
なんか名前を付けろって書いてあるので名前を付ける。
Expirationは色々選べるが今回はデフォルトで。手順には何も書いてない。
スコープは手順に「リポジトリにアクセスするなら[repo]で」って書いてあるのでrepoを選択。
スクロールすると[Generate token]があるのでクリック。
トークンできた。コピーする。
git cloneをトークン使ってやってみる。
sh-4.2$ sudo git clone https://github.com/専務のリポジトリ/ほげほげ.git
Cloning into 'ほげほげ'...
Username for 'https://github.com': shigeo@弊社ドメイン
Password for 'https://shigeo@弊社ドメイン@github.com':
remote: Enumerating objects: 190, done.
remote: Counting objects: 100% (190/190), done.
remote: Compressing objects: 100% (141/141), done.
remote: Total 190 (delta 45), reused 173 (delta 30), pack-reused 0
Receiving objects: 100% (190/190), 641.68 KiB | 16.45 MiB/s, done.
Resolving deltas: 100% (45/45), done.
sh-4.2$ ls -las
total 0
0 drwxrwxrwt 11 root root 298 Sep 6 13:19 .
0 dr-xr-xr-x 18 root root 257 Jul 21 12:26 ..
0 drwxr-xr-x 8 root root 194 Sep 6 13:19 ほげほげ
今度は通った。めでたしめでたし。