どないブログ

なんでも書く

httpsでcloneしたリポジトリへのpushで起きるエラーの解消

httpsを使って git clone したリポジトリへのpushでusernameとpasswordの入力を求められた。

>> git push -u origin head

Username for 'https://github.com': 
Password for 'https://donaisore@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/donaisore/my-app.git/'

ここで GitHub の username と password を入力してもpush出来ない。

どうやら二段階認証の設定をしていると起こるっぽい。

docs.github.com

↑このページを参考に token を発行した。

>> git push -u origin head
Username: ${username}
Password: ${token}

で完了。