事象
- GitHub で2段階認証設定後に push すると "fatal: Authentication failed for" と怒られる。
$ git push -u origin master
Username for 'https://github.com': yoheia
[core]
Password for 'https://yoheia@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/yoheia/yoheia-portfolio.git/'
解決策
- yoheia-portfolio/.git/config*1 を以下の通り編集。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:yoheia/yoheia-portfolio.git ★
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "public"]
url = git@github.com:yoheia/yoheia.github.io.git ★
active = true
- yoheia-portfolio/.git/modules/public/.git/config を以下の通り編集。
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
worktree = ../../../public
[remote "origin"]
url = git@github.com:yoheia/yoheia.github.io.git ★
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master