I'm trying to use Jenkinsfile to clone git branches and merge them. Skeleton code is as below:
pipeline {
agent {
label ""
}
stages {
stage("Git") {
steps {
git( url: , credentialsId: )
}
}
}
}
Everytime I run this I get the error
stderr: remote: Password authentication is not available for Git operations. remote: You must use a personal access token or SSH key.
Does anyone know how to use git tokens from within jenkinsfile? I'd very much appreciate any help. Thanks
When using a GitHub access token, you must use standard Username with password credentials, where the username is the same as your GitHub username and the password is your access token.
Source - Jenkins Pipeline as code
Steps on how to create a personal access token - Creating a personal access token for the command line