stage(‘Commit & Push’) {
steps {
dir(“eks-python-demo”) {
sh “git config --global user.email ‘[email protected]’”
sh ‘git remote set-url origin https://[email protected]/ksnithya/eks-python-demo.git’
sh ‘git checkout feature’
sh ‘git add -A’
sh ‘git commit -am “Updated image version for Build - $VERSION”’
sh ‘git push origin feature’
sh ‘git fetch --all’
sh ‘git merge -m “merging to main branch” origin/main’
sh ‘git push origin main --force’
}
}
}
I am trying to merge the feature branch to main branch using above code but it fails with below error. Kindly help on this. Feature branch is updated with latest code but merging to main branch is failing. Kindly let me know what wrong is there in code
- git push origin main --force
error: src refspec main does not match any
error: failed to push some refs to ‘GitHub - ksnithya/eks-python-demo’