リモートリポジトリを指定してpushしたら fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

 

リモートリポジトリを指定してpushしたら fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

リモートリポジトリにtopicブランチがあって、ローカルリポジトリにもtopicがあって、ローカルリポジトリのtopicを改修し終えたのでaddしてcommitして、そのあとにリモートリポジトリのtopicブランチにpushしたら下記のようにエラーが発生した

その解決方法をシェアします。

ローカルブランチ

 
$ git branch

develop
* topic

プッシュ

 
$git push origin topic

エラー

 
fatal: 'topic' 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.
 

リモートブランチには確かにtopicブランチあるし、この前まで普通にプッシュ出来てたのにな。

解決

下記のようにすればローカルのブランチを指定して、その指定したローカルのブランチを、指定したリモートブランチにpush出来ます。

 

$ git push origin topic:topic

 参考

 

 

(ここら辺の本を一通り読んで凄いと思ったので紹介、記事は分かりにくいかもしれないので、是非本かって読んでください、基本を徹底するのが良いエンジニアの共通点)

 

 

 

藤沢瞭介(Ryosuke Hujisawa)
  • りょすけと申します。18歳からプログラミングをはじめ、今はフロントエンドでReactを書いたり、AIの勉強を頑張っています。off.tokyoでは、ハイテクやガジェット、それからプログラミングに関する情報まで、エンジニアに役立つ情報を日々発信しています!

未整理記事

コメントする

メールアドレスが公開されることはありません。 が付いている欄は必須項目です