git-disable-http-repositories

Accustomed to updating software versions, unsure which version’s repository to pull code from

fatal: Unencrypted HTTP is not supported for GitLab. Ensure the repository remote URL is using HTTPS

Background introduction

Environment: Windows platform, consistently using TortoiseGit for Git operations, including configuring SSH keys. Previously attempted a script to batch update local repositories.

Previous article link:

When updating the code today, I encountered the previous error and the repository failed to update properly. I thought of updating the repository using INLINE_CODE_0__应该提供了配置,让我继续使用__INLINE_CODE_1, but couldn’t find the corresponding configuration item after searching around.

The simplest solution is, of course, to switch to the ssh协议来更新仓库,公司配置的gitlab短期内不会提供httpsprotocol

Outstanding issues

When writing the batch update script for the local repository, I initially intended to use the INLINE_CODE_0__的方式拉取仓库,也没细查是因为什么,通过小乌龟配置的__INLINE_CODE_1 configuration information, but it wasn’t synchronized to the config, resulting in issues when executing via command line

git pull #提示没有权限,无法正常更新仓库

Checking the key configuration via command is also correct

If you can successfully pull code using TortoiseGit but receive a “key incorrect” error when using the git pull command in the command line, this is likely because TortoiseGit uses PuTTY’s SSH key while the command line uses OpenSSH’s SSH key

The small turtle’s key configuration doesn’t read key file information from the system .ssh folder; instead, it configures the key file path separately when configuring the interface repository. A useful tip: configuring a key for the first repository being pulled allows other repositories to reuse this key file. After PuTTY loads the key, it doesn’t immediately exit but starts an agent service.

By adjusting the global configuration and not using the system default INLINE_CODE_0 setting, Git Bash will use TortoisePlink for SSH operations. This configuration is suitable when using the PuTTY tool that comes with TortoiseGit.

git config --global core.sshCommand "'C:/Program Files/TortoiseGit/bin/TortoisePlink.exe' -batch -ssh"

Modify the file path of the executable as needed to match your Little Turtle installation directory. Due to the full path configuration, no need to add it to system environment variables.

Licensed under CC BY-NC-SA 4.0
Last updated on May 28, 2025 09:47
A financial IT programmer's tinkering and daily life musings
Built with Hugo
Theme Stack designed by Jimmy