简体   繁体   中英

No such user git commit error in Jenkinsfile

I'm trying to run npm version in a node:10 Docker container as part of a Jenkinsfile and am getting the following error.

npm ERR! fatal: unable to look up current user in the passwd file: no such user

Is there a way to allow git to look for the user another way?

Without testing, I can't guarantee this, but it should guide you in the right direction:

Jenkins starts the docker container without a user (using the UID and GID), so you can start it with root (or add a new user in your Dockerfile which is better):

agent {
    docker {
        image 'node:10'
        args  '--user root'
    }
}

Another option is that you can set these environment variables:

export GIT_COMMITTER_NAME=’user_name’
export GIT_COMMITTER_EMAIL=’user_email’

You can add these as part of the Jenkinsfile or Dockerfile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM