Git Author Identity Unknown on Teamcity Docker Build

Viewed 86

I am moving my Teamcity build to docker container but it fails during commit, with author identity unknown error, adding git username and email with git config in Dockerfile is blocked via Xray policy. Older build used to configure the name and email automatically. Dockerfile:

FROM python:3.7
USER root

RUN apt-get update 
RUN apt-get install -y git
RUN apt-get -y install curl
RUN apt-get install openssh-client
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan bitbucket.org >> ~/.ssh/known_hosts

RUN mkdir script
WORKDIR /script
COPY . /script
RUN pip install -r requirements.txt
RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs
RUN mkdir /usr/bin/nodejs
RUN ln -s /usr/bin/nodejs /usr/local/bin/node

Build fails during commit with Author identity unknown\n\n*** Please tell me who you are.\n\nRun\n\n git config --global user.email "you@example.com"\n git config --global user.name "Your Name"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: unable to auto-detect email address (got 'root@some_id.(none)')\n' , Error: None

I tried git config --global username but got blocked via Xray when fetching image for build. I also tried without global which gave fatal: not in a git directory. Build is run through docker wrapper in teamcity

1 Answers

I tried git config --global user.name but got blocked via Xray when fetching image for build.

You would need to add this in your Dockerfile (as USER root), considering this is user.name, not username, and you need to add user.email as well.

If the commands themselves triggers XRay, then try a COPY .gitconfig /root/.gitconfig, with a local .gitconfig (part of your repository checked out by TeamCity), in order to directly create a global configuration file for root to use.

Related