Last active
September 29, 2025 16:00
-
-
Save hirezadehghani/d3c8f9943f017a3c1b5ce177141cb0a3 to your computer and use it in GitHub Desktop.
Fix: Git thinks SSH when .git is in URL (GPG key conflict)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Problem: Git uses SSH instead of HTTPS when .git is in repository URL | |
| ## Symptoms: | |
| - Cloning/pulling fails with SSH authentication errors | |
| - Happens even when using HTTPS URLs ending with `.git` | |
| - Particularly affects setups with GPG signing | |
| ## Root Cause: | |
| Git sometimes interprets URLs with `.git` suffix as SSH URLs when GPG keys are configured | |
| ## Solution: | |
| Remove `.git` from the remote URL: | |
| ```bash | |
| git remote set-url origin https://github.com/username/repository | |
| # Instead of: | |
| # git remote set-url origin https://github.com/username/repository.git | |
| # Before (causing issues): | |
| git clone https://github.com/torvalds/linux.git | |
| # After (works correctly): | |
| git clone https://github.com/torvalds/linux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment