Skip to content

cmake: set correct path to gitconfig on Windows #3078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2021

Conversation

dennisameling
Copy link

@dennisameling dennisameling commented Mar 3, 2021

Closes #3071

Currently, when Git for Windows is built with CMake, the gitconfig system-level file can't be read by Git. Because of this, things like git clone don't work correctly. More details in #3071 (comment). This PR fixes that behavior by mimicking what was already done in config.mak.uname, but then slightly changed to work correctly with CMake.

Note: this applies to all CMake builds where Windows is targeted (WIN32).

Before applying this PR:

denni@DESKTOP-8HTP3NV ARM64 /
$ git config --list --system
fatal: unable to read config file 'C:/Program Files (x86)/Git/arm64/etc/gitconfig': No such file or directory

After applying this PR:

denni@DESKTOP-8HTP3NV ARM64 /
$ git config --list --system
pack.packsizelimit=2g
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files (x86)/Git/mingw32/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=true
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=main

@dscho
Copy link
Member

dscho commented Mar 5, 2021

That looks pretty good. Only the commit message seems to be eager to be improved ;-)

This commit moves the gitconfig on Windows to /etc/gitconfig, which is where Git expects it. For more details, see #3071 (comment)

How about this instead?

cmake(windows): set correct path to the system Git config

Currently, when Git for Windows is built with CMake, the system Git config is
expected in a different location than when building via `make`: the former
expects it to be in `<runtime-prefix>/mingw64/etc/gitconfig`, the latter in
`<runtime-prefix>/etc/gitconfig`.

Because of this, things like `git clone` do not work correctly (because cURL is
no longer able to find its certificate bundle that it needs to validate HTTPS
certificates). See the full bug report and discussion here:
https://github.com/git-for-windows/git/issues/3071#issuecomment-789261386.

This commit aligns the CMake-based build by mimicking what is already done in
`config.mak.uname`.

This closes https://github.com/git-for-windows/git/issues/3071.

@dennisameling dennisameling force-pushed the gitconfig-cmake-windows branch from e6640ed to 57f16f4 Compare March 5, 2021 12:30
@dennisameling
Copy link
Author

Sounds good to me! Just updated the commit message 😊

Currently, when Git for Windows is built with CMake, the system Git config is
expected in a different location than when building via `make`: the former
expects it to be in `<runtime-prefix>/mingw64/etc/gitconfig`, the latter in
`<runtime-prefix>/etc/gitconfig`.

Because of this, things like `git clone` do not work correctly (because cURL is
no longer able to find its certificate bundle that it needs to validate HTTPS
certificates). See the full bug report and discussion here:
git-for-windows#3071 (comment).

This commit aligns the CMake-based build by mimicking what is already done in
`config.mak.uname`.

This closes git-for-windows#3071.

Signed-off-by: Dennis Ameling <[email protected]>
@dscho dscho force-pushed the gitconfig-cmake-windows branch from 57f16f4 to 5fcfa13 Compare March 5, 2021 22:34
@dscho dscho merged commit 4321276 into git-for-windows:main Mar 5, 2021
@dscho dscho added this to the Next release milestone Mar 5, 2021
dscho added a commit that referenced this pull request Mar 6, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 6, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 6, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 6, 2021
cmake: set correct path to gitconfig on Windows
git-for-windows-ci pushed a commit that referenced this pull request Mar 8, 2021
cmake: set correct path to gitconfig on Windows
git-for-windows-ci pushed a commit that referenced this pull request Mar 8, 2021
cmake: set correct path to gitconfig on Windows
git-for-windows-ci pushed a commit that referenced this pull request Mar 8, 2021
cmake: set correct path to gitconfig on Windows
git-for-windows-ci pushed a commit that referenced this pull request Mar 8, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 8, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 10, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 10, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 10, 2021
cmake: set correct path to gitconfig on Windows
dscho added a commit that referenced this pull request Mar 10, 2021
cmake: set correct path to gitconfig on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARM64: cannot read/write system gitconfig
2 participants