LoginSignup
midori_
@midori_ (伊吹 吉田)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

リモートリポジトリのコピーへのpush ができません

リモートリポジトリへ現状のpush をしようとしたのですが
エラーが発生し、できていない様子。。

発生している問題・エラー

$ git push -u origin main
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
[ユーザー名]@github.com: Permission denied (publickey).

または、問題・エラーが起きている画像をここにドラッグアンドドロップ

該当するソースコード

Git bush
git push -u origin main

自分で試したこと

・秘密鍵、公開鍵の再発行
・Git Hub上でURLがsshに切り替わっているかの確認
・git init でのローカルリポジトリの登録

※もしかしてローカルリポジトリのコピーができていない…?

0

2Answer

鍵の設定が間違っているか、リモートリポジトリが設定できていないようです。

鍵の設定が正しいかどうかは ssh -T git@github.com を実行すると確認できます。以下のように出れば成功です。

$ ssh -T git@github.com
Hi ユーザー名! You've successfully authenticated, but GitHub does not provide shell access.

リモートリポジトリの設定は git remote show origin で確認してください。

$ git remote show origin
* remote origin
  Fetch URL: git@github.com:ユーザー名/リポジトリ.git
  Push  URL: git@github.com:ユーザー名/リポジトリ.git
  HEAD branch: main
1

Comments

  1. @midori_

    Questioner
    ありがとうございます!こちらで無事解決することができました!!

Your answer might help someone💌