Hi,

I have this error when I try to commit & push in a pipeline :

*11:22:35* error: src refspec master does not match any. 
*11:22:35* error: failed to push some refs to 'http://****@foo.net/bar.git 
<http://****@gitlab.edelia.net/home/poc/pipeline-poc-sys.git>'

If I click on the url, I go in my project, so the url is correct. It is not 
an empty repository at all, and I have commited something. All solutions 
read on Internet do not speak about my situation.

I am pretty sure it is about the way the project is checkouted by the 
declarative pipeline, which implies a different git command to push.


Example pipeline :

pipeline {
  agent {
    label 'master'
  }
  options {
    timestamps()
    timeout(time: 15, unit: 'MINUTES')
    buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: 
'10'))
  }
  environment {
    GITLAB_CREDENTIALS = credentials('home-build-gitlab-ci-writer')
  }
  stages {
    stage('Test') {
      steps {
        sh "git rev-parse HEAD" // show me last commit
        sh "touch toto"
        sh "git add ."
        sh "git commit -m \'test commit\'"
        sh "git rev-parse HEAD" // show me new last commit
        script {
          def secureUrl = "http://usr:[email protected]/bar.git}";
       
          // do not work
          sh "git push ${secureUrl} master"

          // do not work either
          sh "git push ${secureUrl} origin HEAD:master"
        }
      }
    }
  }
}


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/394eb2b0-10eb-4e04-81bc-9ae8bb9072e6n%40googlegroups.com.

Reply via email to