LoginSignup
10
5

More than 1 year has passed since last update.

git push しようとすると Authentication failedと出てpushができない

Last updated at Posted at 2019-11-10

 エラー内容

Githubデスクトップでpushしようとすると以下のポップアップが出てpushできない。

git.png

解決方法。

git remote set-url origin {new url}

{new url} にはsshのURLを貼る
例えば
Githubユーザーネームがhoge
リモートリポジトリ名がhogehoge
だった場合は

git remote set-url git@github.com:hoge/hogehoge.git

となる。

解決までに試したこと

sshキーの確認

ssh -T git@github.com

と入力後

Hi hoge! You've successfully authenticated, but GitHub does not provide shell access.

と表示されたのでsshの鍵は設定できている

ターミナルで直接入力

git push origin master

と入力

fatal: 'git@github.com/hoge/hogehoge' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

と出て、よくわからんとなった。

原因

どうやら Live Share拡張機能が原因みたい
(Githubのissueでも上がっていたので
https://github.com/MicrosoftDocs/live-share/issues/1566?fbclid=IwAR2kYkmxwStTbY1G7gG7qQC6_G8Guu-Y61x0KQxsWWtQjUN9vY8F3yPiRNY)

Vscode操作中に
キーチェーンのパスを求める画像がでてきた。
パスワードを入れて「常に許可」を押した後にタイトルのエラーがでた。
なのでsshのアドレスの読み込みがその操作でできなくなり
再度設定することで読み込むことができるようになったのかなと。

ぼやき

昨日まで操作に問題なかったのでこれといった原因を特定できず。
git remote -vで現在のアドレスを確認したがもちろん、問題なかった。
アドレスの変更をした覚えはないので。思わぬ時間をくってしまった。

参考URL:https://qiita.com/minoringo/items/917e325892733e0d606e

10
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
5