- Как мне установить SSL в ГИТ не будет проверять для конкретного РЕПО только?
- 8 ответов:
- Настройка SSL в git для сертификата StartSSL, да и Self-signed сертифката тоже
- Git stopped working over SSL on Windows
- configure Git to accept a particular self-signed server certificate for a particular https remote
- 3 Answers 3
- Get self signed certificate of remote server
- Get certificate using openssl
- Get certificate using your web browser
- Having the trusted certificate in dedicated file
- Configure git to trust this certificate
- How do I configure Git to trust certificates from the Windows Certificate Store?
- 2 Answers 2
Как мне установить SSL в ГИТ не будет проверять для конкретного РЕПО только?
Я должен использовать git-сервер без соответствующих сертификатов, но я не хочу этого делать
каждый раз, когда я делаю работу ЖКТ. Но я также хотел бы оставить SSL включенным для других репозиториев git. Есть ли способ сделать это локальным для одного РЕПО?
8 ответов:
в вашем конкретном репо, чтобы отключить проверку сертификатов SSL только для этого РЕПО.
как то, что сказал Тирумалай, но внутри клонированного хранилища и без —global . То есть,
- GIT_SSL_NO_VERIFY=true git clone https://url
- cd
- git config http.sslVerify false
для одного РЕПО
Если вы находитесь на машине с Windows и установлен Git, вы можете попробовать следующие действия:
- перейдите в папку установки Git, например: C:\Program файлы (x86)\Git\etc
- редактировать файл: gitconfig
под [http] добавьте строку: sslVerify = false
в частности, если вам нужен рекурсивный клон
для windows, Если вы хотите глобальную конфигурацию, то запустите
в Linux, если вы вызываете это внутри папки репозитория git:
добавить sslVerify = false на на на .git папка, которая также может быть решением, если вы хотите добавить это вручную с помощью nano .git/config :
существует простой способ настройки GIT для правильной работы вашего сервера. Просто добавьте определенный раздел http для вашего сервера git и укажите, какой сертификат (кодированный Base64) доверять:
таким образом, вы больше не будете иметь ошибок SSL и проверить (обычно) самозаверяющий сертификат. Это лучший способ пойти, так как он защищает вас от атак человека в середине. Когда вы просто отключаете проверку ssl, вы уязвимы для такого рода атак.
Настройка SSL в git для сертификата StartSSL, да и Self-signed сертифката тоже
После того как на своем рабочем компе год назад установил сборку msysGit для Windows так и не обновлял её и в принципе, ходил я по нешифрованному порту в своей домашней локалке и всё меня устраивало, пока не появилась необходимость выставить один из своих репозиториев во внешний мир. Тут уж мои параноик сказал: «Только шифрованный трафик, ибо PRISM не спит, да и вообще, много людей бессонницей страдают».
Отправился я на StartSSL, порегался и выписал себе сертификат. Бодро настроил свой сервер на шифрование трафика и давай менять origin в своих репозитроиях. И первый же мой pull-request сказал, что я инвалид и сертификаты мои непонято кем выписаны: «Не возможно проверить путь сертификации». Скоро сказка сказывается, да не скоро дело делается. В общем, даю готовое решение проблемы. Суть в том, что Git использует кучу всякого софта (принцип интероперабельности, итить его налево) для своей работы, и в том числе хранит список корневых сертификатов своим особенным образом в файле «curl-ca-bundle.crt» и наша задача положить туда наш промежуточный сертификат. Достать его можно следующим образом:
- Заходим бразуером по нашему адресу
- На значке ssl (значок замка перед адресом практически во всех браузерах) нажимаем правой кнопкой и смотрим свойства сертификата (см. рис 1.)
- Сохраняем сертификат в файл в кодировке base64.
- Открываем файл сертификата и его содержимое копируем в конец нашего файла «curl-ca-bundle.crt», у меня он находится по адресу C:/Program Files (x86)/Git/bin/curl-ca-bundle.crt
Рисунок 1. Инструкция по извлечению сертификата
Git stopped working over SSL on Windows
We have a new TFS 2017 server set up on-premises. My sysadmin set up https and generated a self-signed certificate. Everything works fine with Visual Studio’s built-in git tools. When I try to do anything from the CLI, I get the following error: SSL certificate problem: unable to get local issuer certificate
What I have tried:
Installed the certificate in the Trusted Root Certificate Authorities store on my client machine (it is also installed on the server). To install it, I simply double-clicked the .pfx file provided to me, entered the password, and chose the Trusted Root store.
After some troubleshooting, I exported the local certificate as a Base-64 encoded x.509 (.CER) file, and appended it to ca-bundle.crt
Double-checked my git config to ensure http.sslcainfo is pointed to the correct ca-bundle.crt file.
Used openssl to connect to my server. This gives me two error messages: verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 OU = Created by Team Foundation Server, CN = my.company.com verify error:num=21:unable to verify the first certificate verify return:1 Certificate chain 0 s:/OU=Created by Team Foundation Server/CN=my.company.com i:/OU=Created by Team Foundation Server/CN=my.company.com
Tried to use the CLI from other machines to connect over https, with the same results.
Update
Still no luck getting this working, but was curious if the fact that the self-signed certificate is signed with a private key would have anything to do with our issues.
configure Git to accept a particular self-signed server certificate for a particular https remote
The sysadmin for a project I’m on has decided that SSH is «too much trouble»; instead, he has set up Git to be accessible via an https:// URL (and username/password authentication). The server for this URL presents a self-signed certificate, so he advised everyone to turn off certificate validation. This does not strike me as a good setup, security-wise.
Is it possible to tell Git that for remote X (or better, any remote in any repository that happens to begin with https://$SERVERNAME/ ) it is to accept a particular certificate, and only that certificate? Basically reduplicate SSH’s server-key behavior.
3 Answers 3
- Get the self signed certificate
- Put it into some (e.g.
/git-certs/cert.pem ) file
In more details:
Get self signed certificate of remote server
Assuming, the server URL is repos.sample.com and you want to access it over port 443 .
There are multiple options, how to get it.
Get certificate using openssl
Catch the output into a file cert.pem and delete all but part between (and including) -BEGIN CERTIFICATE- and -END CERTIFICATE-
Content of resulting file
/git-certs/cert.pem may look like this:
Get certificate using your web browser
I use Redmine with Git repositories and I access the same URL for web UI and for git command line access. This way, I had to add exception for that domain into my web browser.
Using Firefox, I went to Options -> Advanced -> Certificates -> View Certificates -> Servers , found there the selfsigned host, selected it and using Export button I got exactly the same file, as created using openssl .
Note: I was a bit surprised, there is no name of the authority visibly mentioned. This is fine.
Having the trusted certificate in dedicated file
Previous steps shall result in having the certificate in some file. It does not matter, what file it is as long as it is visible to your git when accessing that domain. I used
Note: If you need more trusted selfsigned certificates, put them into the same file:
This shall work (but I tested it only with single certificate).
Configure git to trust this certificate
You may also try to do that system wide, using —system instead of —global .
And test it: You shall now be able communicating with your server without resorting to:
If you already set your git to ignorance of ssl certificates, unset it:
and you may also check, that you did it all correctly, without spelling errors:
what should list all variables, you have set globally. (I mispelled http to htt).
How do I configure Git to trust certificates from the Windows Certificate Store?
Currently I have the following entry in my .gitconfig in my user directory.
This sets the certificate to use when interacting with the git server (required by my company’s git server).
But now I cannot clone other repositories (for example a public repository on GitHub), because the client always uses the configured certificate which gets rejected by other servers.
How can I circumvent this certification issue? Can I configure Git to use the Windows Certificate Store to authenticate?
2 Answers 2
Beginning with Git for Windows 2.14, you can now configure Git to use SChannel, the built-in Windows networking layer. This means that it will use the Windows certificate storage mechanism and you do not need to explicitly configure the curl CA storage mechanism.
From the Git for Windows 2.14 release notes:
It is now possible to switch between Secure Channel and OpenSSL for Git’s HTTPS transport by setting the http.sslBackend config variable to «openssl» or «schannel» ; This is now also the method used by the installer (rather than copying libcurl-4.dll files around).
You can choose the new SChannel mechanism during the installation of Git for Windows 2.14. You can also update an existing installation to use SChannel by running: