スキップしてメイン コンテンツに移動

githubの認証が失敗した!2021年8月13日から変わった認証対処方法

今まで問題なく使われていたGitレポジトリーが急にエラーが出て止まった!



On branch master
Your branch is up to date with 'origin/master'.

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: unable to access 'https://github.com/LowyShin/Knowledgebase.git/': The requested URL returned error: 403


https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

のページを見てみると2021年8月13日から認証方法が変わったのでこれからはパスワードを使わずにaccess_tokenを使え!とのことです。


それでWindows Credentialをいじればいいと思って削除してもう一度git pushを投げたのにできません!


どうせaccess_tokenに変わったしどうせ期限もあるので勝手に.git/configを修正しちゃいました。


Windowsのvscodeならterminalからnotepad .git/config <enter>

するとノートパットが開いてgithubの設定情報が出てきます。


urlと書かれているところに

自分のGitHubID:<access_token>@github.com/reponame

例えば


url = https://lowyshin:akaejfwueyrlwe@github.com/LowyShin/Lowyworkenv.git


のように修正します。

それでいつもの通りに


git pull origin master

git add .

git commit -m "modified access_token"

git push origin master


をしてみたら成功!


Windows CredentialとかMacの資格証明がよくわからない方はこのようにしてください~。


コメント