Technically Impossible

Lets look at the weak link in your statement. Anything "Technically Impossible" basically means we haven't figured out how yet.

Error from Visual Studio and GitHub integration - error setting certificate verify location


Abstract

Accessing GitHub with Visual Studio sometime causes error. ITs typical case is the image attached above. It says that the certificate is not found at the designate path.

This is the cause of error, but it is not root cause. The another factor makes Git in Visual Studio pointing to wrong destination, and this is the root cause.

This post introduces

Specify a cause command "git config"
fix a problem edit file "gitconfig"
typical solution and its problem copy certificate

Specify a cause with the command "git config"

Certificate (CRT file) and its path is described at [http] section in a file "gitconfig". Visual Studio has its own Git and it is saved at the next path.

C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin

Execute the next command here.

git conofig -l --show-origin

Output from the command

file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	core.symlinks=false
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	core.autocrlf=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	color.diff=auto
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	color.status=auto
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	color.branch=auto
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	color.interactive=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	pack.packsizelimit=2g
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	help.format=html
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	http.sslcainfo=%(prefix)/ssl/certs/ca-bundle.crt
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	diff.astextplain.textconv=astextplain
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	rebase.autosquash=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	filter.lfs.required=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	credential.helper=manager-core
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	credential.https://dev.azure.com.usehttppath=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	include.path=C:/Program Files (x86)/Git/etc/gitconfig
file:C:/Program Files (x86)/Git/etc/gitconfig	core.symlinks=false
file:C:/Program Files (x86)/Git/etc/gitconfig	core.autocrlf=true
file:C:/Program Files (x86)/Git/etc/gitconfig	color.diff=auto
file:C:/Program Files (x86)/Git/etc/gitconfig	color.status=auto
file:C:/Program Files (x86)/Git/etc/gitconfig	color.branch=auto
file:C:/Program Files (x86)/Git/etc/gitconfig	color.interactive=true
file:C:/Program Files (x86)/Git/etc/gitconfig	pack.packsizelimit=2g
file:C:/Program Files (x86)/Git/etc/gitconfig	help.format=html
file:C:/Program Files (x86)/Git/etc/gitconfig	http.sslcainfo=/bin/curl-ca-bundle.crt
file:C:/Program Files (x86)/Git/etc/gitconfig	sendemail.smtpserver=/bin/msmtp.exe
file:C:/Program Files (x86)/Git/etc/gitconfig	diff.astextplain.textconv=astextplain
file:C:/Program Files (x86)/Git/etc/gitconfig	rebase.autosquash=true
file:C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig	include.path=C:/Program Files/Git/etc/gitconfig
file:C:/Users/%USERNAME%/.gitconfig	filter.lfs.clean=git-lfs clean -- %f
file:C:/Users/%USERNAME%/.gitconfig	filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Users/%USERNAME%/.gitconfig	filter.lfs.process=git-lfs filter-process
file:C:/Users/%USERNAME%/.gitconfig	filter.lfs.required=true
file:C:/Users/%USERNAME%/.gitconfig	user.name=espio999
file:C:/Users/%USERNAME%/.gitconfig	user.email=espio999@users.noreply.github.com

This output indicates that multiple "gitconfig" below are referred.

  • gitconfig - 1, this is for system configuration of Visual Studio Git
C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/etc/gitconfig
  • gitconfig - 2, this is for user configuration of Visual Studio Git
C:/Users/%USERNAME%/.gitconfig
  • gitconfig - 3, this is for system configuration of original Git. Probably for GitHub Desktop in mycase.
C:/Program Files (x86)/Git/etc/gitconfig

Reading [http] section of these files, found that configuration between gitconfig-1 and 3 is different as

gitconfig - 1 sslCAinfo = %(prefix)/ssl/certs/ca-bundle.crt
gitconfig - 3 sslCAinfo = /bin/curl-ca-bundle.crt

And comparing these paths and the error message at the top of this post, would notice that Visual Studio refers inappropriate path below, in spite of it should refer appropriate one.

  • Inappropriate path
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin\curl-ca-bundle.crt
  • Appropriate path
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\ssl\certs\ca-bundle.crt

fix a problem

Using multiple "gitconfig", one configuration is inherited and given priority. This inheritance composes inappropriate not intended. As this inheritance is not avoided, solution is to make it not produced.
Its direct way is to make inappropriate configuration commented. In the case of this post, configuration from gitconfig - 3 is inherited. Its [http] section should be commented as

[http]
	;sslCAinfo = /bin/curl-ca-bundle.crt

Typical solution and its problem

Typical solution other than editing "gitconfig" is to copy certificate (CRT file) from appropriate path to inappropriate one. But this is not recommended here.

Example, when the other Visual Studio (example its newer version) is installed, it would bring the other own Git with newly generated certificate together. Appropriate path and inappropriate one may be composed again at that time. And new certificate must be copied from one to the other again.

Putting assumption that the path should be kept appropriate, user should care of appropriate path, not certificate.