Skip to content

Allow to customize the .gitconfig? #168

@gaeljw

Description

@gaeljw

Hello folks,

Would it make sense to allow to customize the .gitconfig used by Sourcebot through Sourcebot config? Or we say it's not Sourcebot responsibility and the user has to define the .gitconfig however needed depending on Sourcebot is installed (like mounting a volume to /root/.gitconfig if using the container/K8S approach).

I'm asking the question because I faced the need to configure the .gitconfig for a corner case today due to mounting the repos through a volume that didn't have the right file ownerships.

I was facing the following error:

[backend] | 2025-01-16T13:18:28.357Z error: [main] fatal: detected dubious ownership in repository at '/data/repos/gitlab.mycompany.net/mygroup/myrepo.git'
[backend] | To add an exception for this directory, call:
[backend] |
[backend] | 	git config --global --add safe.directory /data/repos/gitlab.mycompany.net/mygroup/myrepo.git
[backend] |
[backend] | Error: fatal: detected dubious ownership in repository at '/data/repos/gitlab.mycompany.net/mygroup/myrepo.git'
[backend] | To add an exception for this directory, call:
[backend] |
[backend] | 	git config --global --add safe.directory /data/repos/gitlab.mycompany.net/mygroup/myrepo.git
[backend] |
[backend] |     at Object.action (file:///app/node_modules/simple-git/dist/esm/index.js:4462:25)
[backend] |     at PluginStore.exec (file:///app/node_modules/simple-git/dist/esm/index.js:4501:25)
[backend] |     at file:///app/node_modules/simple-git/dist/esm/index.js:1369:43
[backend] |     at new Promise (<anonymous>)
[backend] |     at GitExecutorChain.handleTaskData (file:///app/node_modules/simple-git/dist/esm/index.js:1367:16)
[backend] |     at GitExecutorChain.<anonymous> (file:///app/node_modules/simple-git/dist/esm/index.js:1351:44)
[backend] |     at Generator.next (<anonymous>)
[backend] |     at fulfilled (file:///app/node_modules/simple-git/dist/esm/index.js:45:24)
[backend] |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

And I temporarily worked around it by adding a .gitconfig with following content in Sourcebot pod:

[safe]
	directory = *

Obviously, this is quite a corner case but I wanted to track this here if anyone face the same issue and/or if there's other cases of having to customize the .gitconfig in the future 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions