
リモートリポジトリを指定して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
参考
(ここら辺の本を一通り読んで凄いと思ったので紹介、記事は分かりにくいかもしれないので、是非本かって読んでください、基本を徹底するのが良いエンジニアの共通点)