The note is partly generated by “ChatGPT.”
The article “Proxy set, but ssh -T git@github.com still fails” explains that Git SSH cannot use an HTTP proxy and provides a solution. However, in my experience, even using that solution, network performance can be unreliable. Therefore, if you can use HTTPS for Git, I recommend switching from SSH to HTTPS directly. Below is the method to switch to HTTPS and configure a Personal Access Token (PAT) for authentication.
1️⃣ Ensure your Git remote uses HTTPS
Check your current remote:
| |
If it shows something like:
origin git@github.com:jzjizhe/MyAstroNvim.git (fetch)
origin git@github.com:jzjizhe/MyAstroNvim.git (push)
Switch it to HTTPS:
| |
Verify:
| |
2️⃣ Generate a Personal Access Token (PAT) on GitHub
Go to GitHub → Settings → Developer settings → Personal Access Tokens
Click Generate new token (classic)
Select repo permission
Copy the token (you’ll use it instead of a password)
3️⃣ Configure Git credential helper
This stores your credentials securely so you don’t have to type them again.
Windows:
| |
Linux / WSL:
- Cache for 1 hour (memory):
| |
- Or store permanently (plaintext, not recommended for multi-user machines):
| |
4️⃣ Push / Pull and enter credentials once
The first time you push:
| |
Git will prompt for:
Username:
jzjizhePassword:
<your PAT>
After this, the credential helper caches it, so future push/pull commands won’t ask again.
5️⃣ Optional: Configure proxy (if needed)
If you are behind a network proxy:
| |
✅ Result:
Git over HTTPS works without repeated credential prompts.
Works behind most HTTP/SOCKS proxies.
No SSH key setup needed.