githubのイレギュラー備忘録
■起きたこと
・githubのパスワードを失念
・二段階認証設定していた+スマホ変更したため二度とログインできない
★2段階認証システム 機種変更時の再設定方法
・新しいgithubアカウント作成
↓
・今まで使っていたgithub desktopをサインアウトし、新しいgithubアカウントでサインイン(サインインはできていること確認)
・git cloneしようとしても、「Please tell me who you are」の表示
★git config --global user.email "you@example.com"
★git config --global user.name "Your Name"
これらを求められている。
最初にやったこと シェルで--globalの入力
$git config --global user.email "you@example.com"
$git config --global user.name "Your Name"
これらを入力しても
error: could not lock config file .git/config: が出る
次にやったこと SSHの設定
鍵を格納するディレクトリへ移動
$cd ~/.ssh/
鍵を作成する
$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/ユーザー名/.ssh/id_rsa): <--SSH Keysの保存先
Enter passphrase (empty for no passphrase): <-- パスフレーズを入力
Enter same passphrase again: <-- もう一度、パスフレーズを入力
githubでSSHの設定
https://github.com/settings/keys
github SSH接続の確認
$ssh -T git@github.com
これが返ってきたらOK
Hi (account名)! You've successfully authenticated, but GitHub does not provide shell access.
そこで再び
$git config --global user.email "you@example.com"
$git config --global user.name "Your Name"
これらを入力してもやっぱり
error: could not lock config file .git/config: が出るので、
$git config --local user.email "you@example.com"
$git config --local user.name "Your Name"
--local はOK
SSHの設定しなくてもいいかも
--global でNGの場合は --local で入力するといける。
この記事が気に入ったらサポートをしてみませんか?