Skip to content

Passing configuration parameter (git -c or git --config-env=) - set_persistent_git_options() (mostly) works #1604

Description

@linde12

Hi!

I want to override system wide and global git configs for all commands i'm running in this repo in order to set credential.helper to nothing (dont cache or use system store to save my passwords)

This can be done with git like so:

git -c credential.helper="" fetch

but, if possible, i'd like to use gitpythons Repo to fetch my do my fetching, but i can't find a way to pass the -c flag to git itself and not git-fetch. E.g. doing the following doesn't work because the flag is passed to git-fetch:

repo = Repo.init(path)
remote = repo.create_head(...)
...
remote.fetch(ref, c=\credential.helper=""')

because that essentially does:

git fetch -c credential.helper=""

but git-fetch doesn't know about any -c flag, only git does.

Is this even possible with gitpython? Thanks!

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