Git config is weirdly synchronized between host and guest
- Dominant language
- HTML
- Stars
- 57
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
If you use Git to commit inside the Vagrant box, you end-up with a commit signed by "Vagrant User" instead of your name/email configured in your host git config.
**Reproduction Steps:**
1. Create a blank box with the role Git
2. Commit something inside the box: `git commit -m "Test" --allow-empty`
3. The commit is signed by "Vagrant User" with a generated email depending on the project name
**Expected behavior:**
The commit should be signed with the same config as my host Git config.
**Observed behavior:**
The role git seems to correctly set the config in the guest at /etc/gitconfig. However, another git config is created at ~/.gitconfig. I tried to delete this file but everytime I run a git command, this file gets recreated with an empty "name" and "email" field. I was able to make it work by removing the empty "name" and "email" fields from the ~/.gitconfig file. It then fallback to the /etc/gitconfig values which are the expected ones.
**Drifter version:** 1.4.0
**Vagrant version:** 1.9.5
**OS and version:** MacOS 10.12.6
**Additional information:**
* Problem started happening recently, didn't happen in an older version of Drifter: I think so, it might comes from a new version of Git or differences in the base boxes
* Problem can be reliably reproduced, doesn't happen randomly: Yes
* Problem happens to my colleagues aswell or only me: Yes
Contributor guide
Research direction
Start with the Git role and trace how /etc/gitconfig and ~/.gitconfig are generated when running `git commit -m "Test" --allow-empty` inside the box. Compare the guest configuration with the host settings and verify that the generated ~/.gitconfig no longer overrides the expected name and email; reproduce the result with the stated command.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, git
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100