web関連

【git】git cloneしてpushしようとしたらエラーが出た

git cloneして「ローカルのmasterブランチ→リモートリポジトリのdevelopブランチ」にアップしようとしたら以下のエラーが出た

error: src refspec develop does not match any
error: failed to push some refs to 'https://bitbucket.org/○○/××.git'

ローカルのmasterブランチからリモートリポジトリの別ブランチにアップすることが原因かなと思いgit checkout -b developでローカルにdevelopブランチを作成し「add→commit」を実行

そしたら以下のエラーが出た

$ git push origin develop
To https://bitbucket.org//○○/××.git
 ! [rejected]        develop -> develop (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org//○○/××.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

git pull origin developを実行して「add→commit」をし直して再度pullをしたら治った

上手く紐づいてなかったんかなぁ?
とりあえずgit pullして紐づけるのが大事かもしれない

Leave a Comment

入力エリアすべてが必須項目です。メールアドレスが公開されることはありません。

内容をご確認の上、送信してください。