Updated habit software version, unsure which Git version to start from, prohibiting fetching code from Http
repositories.
fatal: Unencrypted HTTP is not supported for GitLab. Ensure the repository remote URL is using HTTPS
Background Introduction
Environment: Windows platform, I’ve always used Tiny Turtle to operate Git, and key configuration was also handled through it. I previously created a script to batch update local repositories.
Previous article link: Batch Update Local Git Repository
Today when I went home to execute the code update, the previous error occurred, and the repository could no longer be updated normally. I was planning to use Git
’s configuration to continue using the http
protocol to update the repository, but I searched everywhere without finding the corresponding configuration item.
The simplest solution is of course to switch to the ssh
protocol to update the repository, as the gitlab
configured by the company will not provide the https
protocol in the short term.
Legacy Issues
When writing the batch update local repository script previously, we initially planned to use ssh
to pull the repository and didn’t investigate thoroughly. The git
configuration information configured via Small Turtle was not synchronized to the config file, resulting in a “permission denied” error when executing with the command line:
git pull # prompts for permission issues and cannot update the repository normally
Checking the key configuration using the command was correct: ssh -T git@gitlab.yintech.net
If you can successfully pull code using Small Turtle (TortoiseGit), but receive a “key not recognized” error when using the git pull
command from the command line, this may be because Small Turtle uses PuTTY’s SSH key while the command line uses OpenSSH’s SSH key.
The key configuration in Small Turtle does not read key file information from the system .ssh
folder; instead, it configures the path to the key file separately through the interface when configuring the repository. There’s a useful trick: configuring the first pulled repository with its key allows other repositories to reuse that same key file. PuTTY loads the key and doesn’t immediately exit but starts a proxy service.
By adjusting the global configuration to not use the system default ssh
configuration, Git Bash will use TortoisePlink for SSH operations. This configuration is suitable for situations where you are using TortoiseGit with the built-in PuTTY tool.
git config --global core.sshCommand "'C:/Program Files/TortoiseGit/bin/TortoisePlink.exe' -batch -ssh"
Please modify the execution file path in the above configuration to match your Small Turtle installation path. Since the full path is configured, no need to add it to the system environment variables.