others-how to solve SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number when using git push command ?
Problem
When we do git push command like this:
➜ bswen_test3 git:(master) git push --set-upstream origin master
fatal: unable to access 'https://10.2.3.8/bswen/bswen_test3.git/': error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
we get this :
fatal: unable to access 'https://10.2.3.8/bswen/bswen_test3.git/': error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
The core error is : fatal: unable to access ‘https://10.2.3.8/bswen/bswen_test3.git/’: error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
Why do this error happen? The git repository url is correct, I am sure!!!
Environment
- private git repository
Reason
I am using a private git repository and I have not correctly set the certificates in the repository.
Solution
We should use the SSH protocol to connect to the private git repository like this:
Step #1: Change local git repository URL to SSH
Open the .git/config file in your local repository, and change the url like this:
[remote "origin"]
url = [email protected]:bswen/bswen_test3.git
fetch = +refs/heads/*:refs/remotes/origin/*
Step #2: Add your local SSH public key to the git repository
Step #3: Test again
bswen_test3 git:(master) git push --set-upstream origin master
The authenticity of host '10.2.3.8 (10.2.3.8)' can't be established.
ECDSA key fingerprint is SHA256:UoHsAC8GcPvNUHjN8+S5I86YLA7a25pK3yWOpryjEA8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.2.3.8' (ECDSA) to the list of known hosts.
Enumerating objects: 59, done.
Counting objects: 100% (59/59), done.
Delta compression using up to 8 threads
Compressing objects: 100% (38/38), done.
Writing objects: 100% (59/59), 570.69 KiB | 5.54 MiB/s, done.
Total 59 (delta 10), reused 0 (delta 0)
remote: Resolving deltas: 100% (10/10), done.
To 10.2.3.8:bswen/bswen_test3.git
* [new branch] master -> master
It works!