“Git fatal: ref HEAD is not a symbolic ref” while using maven release plugin

后端 未结 10 663
后悔当初
后悔当初 2020-12-23 02:58

I get the following error output while running the Maven release plugin prepare step i.e. mvn release:prepare --batch-mode -DreleaseVersion=1.1.2 -DdevelopmentVersion=

相关标签:
10条回答
  • 2020-12-23 03:03

    The problem in Atlassian Bamboo was solved by un-checking the default setting Use shallow clones with description Fetches the shallowest commit history possible. Do not use if your build depends on full repository history. This checkbox is located under Plan Configuration -> Repositories tab -> Git -> Advanced options

    After this all the releases work fine.

    0 讨论(0)
  • 2020-12-23 03:09

    what worked for me was to call "git checkout -f master" before calling "mvn release"

    0 讨论(0)
  • 2020-12-23 03:12

    The problem is that it is not picking up the branch so before doing mvn release:prepare --batch-mode -DreleaseVersion=1.1.2 -DdevelopmentVersion=1.2.0-SNAPSHOT -Dtag=v1.1.2 -X do git checkout master or the desired branch

    0 讨论(0)
  • 2020-12-23 03:13

    I am using a Jenkins Team Project with a Multibranch Project Setup.

    I previously used checkout scm command.

    Now I am using the following code:

    checkout([
                     $class: 'GitSCM',
                     branches: scm.branches,
                     extensions: scm.extensions + [[$class: 'CleanCheckout'], [$class: 'LocalBranch', localBranch: 'new']],
                     userRemoteConfigs: scm.userRemoteConfigs
                ])
    
    0 讨论(0)
  • 2020-12-23 03:13

    For GitHub actions you can setup actions/checkout@v2 with ref: master

    steps:
      - uses: actions/checkout@v2
        with:
          ref: master
    
    0 讨论(0)
  • 2020-12-23 03:14

    I ran into the same error on Jenkins in combination with maven release plugin, we fixed it by going to Additional behaviours, Check out to specific local branch and enter 'master'

    I realise this is not a solution but it might give you some direction in where to look.

    0 讨论(0)
提交回复
热议问题