GitHubと通信するプロトコルをSSHからHTTPSにする
なぜ?
長らくHTTPSが公式で推奨されている
https://help.github.com/ja/github/using-git/which-remote-url-should-i-use#cloning-with-https-urls-recommended
SSHの設定がめんどう
https://help.github.com/ja/github/authenticating-to-github/connecting-to-github-with-ssh
手順 on macOS
gitconfigでHTTPSを強制する
git config --global url."https://github.com/".insteadOf git@github.com:
または
code:.gitconfig
[url "https://github.com/"]
insteadOf = git@github.com:
insteadOf = git://github.com/
https://blog.n-z.jp/blog/2013-11-28-git-insteadof.html
https://github.com/settings/tokens でaccess tokenを取得する
https://help.github.com/ja/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
osxkeychainでcredentialを管理させる
git config --global credential.helper osxkeychain
https://help.github.com/ja/github/using-git/caching-your-github-password-in-git
read, write権限があるてきとうなrepositoryをcloneして、pushする
キーチェーンに許可を求められるのでOSのパスワードを入力して「常に許可」
CLIのgitでusernamepasswordを入力する
passwordにはaccess tokenを入力する
osxkeychainがaccess token をキャッシュするので二度とパスワードは聞かれない
https://help.github.com/ja/github/using-git/why-is-git-always-asking-for-my-password
複数の git ユーザを持つ場合はgit pullするときにhttps://<username>@<domain>/... で指定する
credential helperはURL単位=実質ユーザ単位で覚えてくれる
https://tech-1natsu.hatenablog.com/entry/2018/10/27/102621
Update access token
access tokenを更新するには、Keychain AccessからName=github.com Kind=Internet Passwordの項目を探し、編集する
https://docs.github.com/en/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain