Я пытался выполнить Git Push из задачи bash в DevOps Azure.Я уже отправлял код в главную ветку без каких-либо проблем.Но теперь я должен перенести его в ветку разработчика, и по какой-то причине Git Pull работает, но не Git Push.Вот шаги, которым я следовал.Я пробовал разные версии этого на самом деле, но ничего не получалось.
git config --global user.email "xxx@gmail.com"
git config --global user.name "abc"
git pull https://PAT@github.com/repo.git HEAD:dev
git add $PROXYNAME
git commit -m 'Auto-checkin of $PROXYNAME proxy to Git'
git show-ref
git push https://PAT@github.com/repo.git HEAD:dev
Выше работало, когда у push / pull было HEAD: master в конце.Это ошибка, которую я получаю каждый раз.
To https://github.com/repo.git
! [rejected] HEAD -> dev (non-fast-forward)
error: failed to push some refs to 'https://***@github.com/repo.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Отредактировано, чтобы добавить: Я также попробовал с командой checkout - проверить эту ветку dev, и не повезло!Результат git remote -v:
origin https://github.com/repo (fetch)
origin https://github.com/repo (push)
Последняя полученная ошибка приведена ниже:
error: src refspec dev does not match any
error: failed to push some refs to 'https://***@github.com/repo.git'
Может кто-нибудь сообщить мне, что мне нужно сделать, чтобы это работало.Похоже, сейчас это повторяющаяся проблема: (