没有不值得去解决的问题,也没有不值得去学习的技术!

Resolve Unknown SSL Protocol Error in Git Bash When git pull Fails on github.com:443 by Switching From HTTPS to SSH

In Git Bash, run git pull from github.com again. The pull is successful

1. Run the command: git pull –progress –no-rebase -v “origin”. An error occurs, as shown in Figure 1
fatal: unable to access ‘https://github.com/shuijingwan/yii2-starter-kit.git/’: Unknown SSL protocol error in connection to github.com:443

fatal: unable to access 'https://github.com/shuijingwan/yii2-starter-kit.git/': Unknown SSL protocol error in connection to github.com:443
fatal: unable to access ‘https://github.com/shuijingwan/yii2-starter-kit.git/’: Unknown SSL protocol error in connection to github.com:443

2. I decided to use SSH for the connection. Since both Git Bash and TortoiseGit might be used, I used the PuTTYgen tool included with TortoiseGit to generate the keys, as shown in Figure 2.

Decided to use SSH for the connection. Since both Git Bash and TortoiseGit might be used, used the PuTTYgen tool included with TortoiseGit to generate the keys
Decided to use SSH for the connection. Since both Git Bash and TortoiseGit might be used, used the PuTTYgen tool included with TortoiseGit to generate the keys

3. After opening it, click the Generate button. During the generation process, you need to keep moving the mouse within the key box to generate some random data, as shown in Figure 3.

After opening it, click the Generate button. During the generation process, you need to keep moving the mouse within the key box to generate some random data
After opening it, click the Generate button. During the generation process, you need to keep moving the mouse within the key box to generate some random data

4. Add the generated public key to GitHub, as shown in Figure 4.

Add the generated public key to GitHub
Add the generated public key to GitHub

5. The list of public keys added on GitHub is shown in Figure 5.

The list of public keys added on GitHub
The list of public keys added on GitHub

6. Select Save private key. The following dialog box pops up; select Yes, as shown in Figure 6.

Select Save private key, the following dialog box pops up, select Yes
Select Save private key, the following dialog box pops up, select Yes

7. Save the private key supported by TortoiseGit to C:\Users\Administrator\.ssh\private.ppk, as shown in Figure 7.

Save the private key supported by TortoiseGit to C:\Users\Administrator\.ssh\private.ppk
Save the private key supported by TortoiseGit to C:\Users\Administrator\.ssh\private.ppk

8. Select Save public key, and save the public key supported by TortoiseGit to C:\Users\Administrator\.ssh\authorized_keys (no extension), as shown in Figure 8.

Select Save public key, save the public key supported by TortoiseGit to C:\Users\Administrator\.ssh\authorized_keys (no extension)
Select Save public key, save the public key supported by TortoiseGit to C:\Users\Administrator\.ssh\authorized_keys (no extension)

9. Run the Pageant program from the TortoiseGit software package, as shown in Figure 9.

Run the Pageant program from the TortoiseGit software package
Run the Pageant program from the TortoiseGit software package

10. Right-click the icon in the bottom right corner (notification area) of the Windows desktop to bring up the following menu, as shown in Figure 10.

Right-click the icon in the bottom right corner (notification area) of the Windows desktop to bring up the following menu
Right-click the icon in the bottom right corner (notification area) of the Windows desktop to bring up the following menu

11. Select the Add Key menu item. The Select Private Key File dialog box appears. Select the previously generated corresponding private key file (.ppk) to complete the configuration, as shown in Figure 11.

Select the Add Key menu item, the Select Private Key File dialog box appears, select the previously generated corresponding private key file (.ppk) to complete the configuration
Select the Add Key menu item, the Select Private Key File dialog box appears, select the previously generated corresponding private key file (.ppk) to complete the configuration

12. The SSH connection for TortoiseGit is now configured. Next, I will continue to configure the connection for Git Bash.

13. I now have the PuTTY private key supported by TortoiseGit. To use it in Git Bash, I need an OpenSSH private key, which simply requires a conversion.

14. Click the menu Conversions->Export OpenSSH Key, as shown in Figure 12.

Click the menu Conversions->Export OpenSSH Key
Click the menu Conversions->Export OpenSSH Key

15. Save the private key supported by Git Bash to C:\Users\Administrator\.ssh\id_rsa, as shown in Figure 13.

Save the private key supported by Git Bash to C:\Users\Administrator\.ssh\id_rsa
Save the private key supported by Git Bash to C:\Users\Administrator\.ssh\id_rsa

16. To test the support in TortoiseGit, change the origin URL to: git@github.com:shuijingwan/yii2-starter-kit.git, and save it, as shown in Figure 14.

To test the support in TortoiseGit, change the origin URL to: git@github.com:shuijingwan/yii2-starter-kit.git, and save it
To test the support in TortoiseGit, change the origin URL to: git@github.com:shuijingwan/yii2-starter-kit.git, and save it

17. Perform a pull operation in TortoiseGit, as shown in Figure 15.

Perform a pull operation in TortoiseGit
Perform a pull operation in TortoiseGit

18. The TortoiseGit pull is successful, as shown in Figure 16.

TortoiseGit pull is successful
TortoiseGit pull is successful

19. In Git Bash, run git pull from github.com again. The pull is successful, as shown in Figure 17.

In Git Bash, run git pull from github.com again. The pull is successful
In Git Bash, run git pull from github.com again. The pull is successful

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系