git push --set-upstream repoUrl branch  

Le dimanche 20 décembre 2020 à 12:24:16 UTC+1, Yannick Lacaute a écrit :

> Ok found it :
>
> git push --set-upstream repoUrl HEAD:<BRANCH>
>
>
> Le dimanche 20 décembre 2020 à 11:45:43 UTC+1, Yannick Lacaute a écrit :
>
>> 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'))
>>   }
>>   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:p...@foo.net/bar.git 
>> <http://usr:p...@foo.net/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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b0de1483-4c62-469f-9ef6-40c74f2060c7n%40googlegroups.com.

Reply via email to