Skip to content

git_config settings doesn't applied #369

Description

@maestrow

I have git_config option in git resource. And no one option seems to be applied.

How to reproduce

Assume the following pipeline config saved to git-config.yml:

resources:
- name: repo
  type: git
  icon: github
  source:
    uri: git@github.com:maestrow/concourse-examples.git
    private_key: |
      -----BEGIN OPENSSH PRIVATE KEY-----
      -----END OPENSSH PRIVATE KEY-----
    branch: master
    git_config:
    - name: user.name
      value: conc
    - name: user.email
      value: conc@local.lo
    - name: core.bigFileThreshold
      value: 10m

jobs:
- name: git_config_job
  plan:
  - get: repo
    trigger: true
  - task: create-commit
    config:
      platform: linux
      image_resource:
        type: registry-image
        source:
          repository: gitea/gitea # use any image that has the git cli
      inputs:
      - name: repo
      outputs:
      - name: repo
      run:
        path: sh
        args:
        - -cx
        # git config --global user.name conc
        # git config --global user.email conc@local
        - |
          cd repo
          whoami
          cat ~/.gitconfig
          cat .git/config
          date > todays-date
          git add ./todays-date
          git commit -m "Update todays date"
  - put: repo
    params:
      repository: repo

Set this pipeline: fly -t tutorial set-pipeline -p git_config -c git-config.yml.
Then trigger fly -t tutorial trigger-job -j git_config/git_config_job --watch.

Actual result

What we see in output:

running sh -cx cd repo
whoami
cat ~/.gitconfig
cat .git/config
date > todays-date
git add ./todays-date
git commit -m "Update todays date"

+ cd repo
+ whoami
root
+ cat /root/.gitconfig
cat: can't open '/root/.gitconfig': No such file or directory
+ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = git@github.com:maestrow/concourse-examples.git
        fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
        remote = origin
        merge = refs/heads/master
+ date
+ git add ./todays-date
+ git commit -m 'Update todays date'
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.

The most important part is /root/.gitconfig: No such file or directory.

Expected result

  • /root/.gitconfig file exists. I expect that because all global git settings stores in this file. My use case shows that this file doesn't exists. And as a result git hasn't any global settings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions