タイトル通りgithubにpushしようとした際に、SSH接続が必要だったので、備忘録として書いていこうと思います。
" git push"
としたところ、
remote: Invalid username or password.
fatal: Authentication failed for 自分のgitURL
とエラーが出ました。
以下コマンドで、GitHubのユーザ名を再設定すれば解決しました。
" git config --global user.name ユーザ名"
再度pushすると、GitHubのユーザ名とパスワードを求められるので入力すればOKでした。
"
git push origin HEAD
Username for 'https://github.com': ユーザ名
Password for 'https://donchan922@github.com': パスワード
"
GitHub上の変更後パスワードとローカルのパスワードが一致していないことで起きたものみたいです。
----
The authenticity of host 'github.com ()' can't be established.
key fingerprint is
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?
----
とエラーがでた。
sshやscpで初めて接続するとサーバなどでも聞かれるようです。
gitでssh接続に変更したあとpushしようとしたら聞かれました。
無事ssh接続に成功!嬉しい。。
そしてpull してみたところ、、
まだエラーがでました。。!!泣
原因を探ってみるとURLが消えてしまっていたためssh用URLに設定。
"
git remote set-url origin git@github.com:<Gitユーザー名>/<リポジトリ名>.git
git remote -v
"
で設定を確認し無事設定出来ていることを確認。
そうしてpushしてみると。。無事成功しました!
紆余曲折ありましたが解決してよかったですし嬉しかったです。
また何かあれば(確実にあるとは思いますが汗)備忘録として残していきたいと思います。
-----------
下記のサイト参考にしました。
https://reasonable-code.com/github-invalid-error/
https://urashita.com/archives/34227
https://trios.pro/github-403-error/