Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

gert and git do not agree on what order to read the config

Open
#196 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
git, r
Domain
tooling

Research direction

Reproduce the configuration-ordering difference from /path/to/project using the shown .gitconfig and IncludeIf files, comparing command-line git with gert from R. Read gert's configuration handling and determine how duplicate keys and included files are ordered; done means both clients select the same Bizarro credentials regardless of the IncludeIf location.

Written by the indexing model from the issue text.

Description

It looks like {gert} prioritizes config items from top to bottom, but command line git prioritizes bottom to top in the case of duplicate keys.

I have a situation where I want to use a different set of credentials for a project. I found the IncludeIf directive for .gitconfig files from https://nicknisi.com/posts/git-includeif/ and I applied it like so:

[user]
    name="Clark"
    [email protected]

[credential]
    helper=/path/to/helper

# ... gitconfig stuff ...

[includeIf "gitdir:/path/to/project"]
  path = ~/.gitconfig-pat

and in my ~/.gitconfig-pat I have it set up to use the GitHub credentials for "Bizarro" in which I provision a temporary PAT inside of an environmental variable called BIZARRO_TOKEN a la https://git-scm.com/docs/gitfaq#http-credentials-environment

[user]
    name="Bizarro"
    [email protected]

[credential]
    helper = '!f() {echo username=clark-is-not-bizarro && echo "password=${BIZARRO_TOKEN}"};f'

When I run git from /path/to/project in the command line, I can commit, push, and pull as "Bizarro", but if I open R and run {gert} from the same directory, I am recognized as "Clark".

If I move the IncludeIf statement to the top of the file, then {gert} will recognize "Bizarro", but git will recognise "Clark"

Dominant language
R
Stars
162
Forks
39
Avg merge
2m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/gert

All issues in r-lib/gert

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.