Git Push输入密码后卡顿无响应问题求助
Hey folks, let's tackle this push issue you're facing. From your verbose logs, it's clear you're getting through authentication (that 200 response confirms it) but Git just freezes up right after. Since pull works perfectly, this isn't a basic connectivity problem—it's likely a quirk with how Git handles the push stream on your Windows setup, or compatibility with the server's HTTP/2 configuration.
Here are some targeted fixes to try, ordered from easiest to more involved:
1. Force Git to Use HTTP/1.1 Instead of HTTP/2
Your logs show Git is using HTTP/2, and older Git versions (yours is 2.20.1, released back in 2019) sometimes have trouble maintaining HTTP/2 connections with certain GitLab server setups. Let's switch to HTTP/1.1 for this repo:
Open Git Bash or Command Prompt, navigate to your repo folder, and run:
git config --local http.version HTTP/1.1
Then try your push again with git push origin master.
2. Increase Git's Post Buffer Size
If you're pushing large files or a batch of changes, a small buffer size can cause the push to hang mid-transfer. Bump up the buffer to handle larger payloads:
git config --local http.postBuffer 524288000
This sets it to 500MB, which should cover most university course materials.
3. Switch to SSH Authentication
HTTPS can be finicky on Windows sometimes—SSH might bypass the hanging issue entirely. Here's how to set it up:
- Generate an SSH key on your machine (if you don't already have one):
Follow the prompts (default save location is fine; you can skip the passphrase if you want, though it's safer to use one).ssh-keygen -t ed25519 -C "your-university-email@school.edu" - Open the public key file (
C:\Users\<YourUsername>\.ssh\id_ed25519.pub) with Notepad and copy its entire content. - Log into your university GitLab account, go to Profile > Settings > SSH Keys, paste the public key, and save it.
- Update your repo's remote URL to use SSH:
Replacegit remote set-url origin git@<your-gitlab-host>:<your-repo-path>.git<your-gitlab-host>and<your-repo-path>with your actual GitLab server details. - Try pushing again.
4. Temporarily Disable Windows Firewall/Antivirus
Windows security tools sometimes block Git's network traffic mid-push, even if they let the initial connection through. Temporarily turn off your Windows Firewall and any third-party antivirus, then attempt the push. If it works, add git.exe (located in C:\Program Files\Git\bin) to the allowed apps list in your security software.
5. Update Git to the Latest Version
Your Git version is quite outdated—there have been hundreds of fixes for Windows-specific bugs since 2019. Grab the latest Windows installer from the official Git page, install it, and try pushing again. This alone might resolve the issue.
6. Check for Misconfigured Proxy Settings
If your university uses a proxy server, Git might be trying to route traffic to the internal GitLab server through it, causing a hang. Check if a proxy is set:
git config --global --get http.proxy git config --global --get https.proxy
If you see a proxy listed, and your GitLab server is internal, exclude it from the proxy settings:
git config --global http.<your-gitlab-host>.proxy "" git config --global https.<your-gitlab-host>.proxy ""
Give these steps a shot and let us know which one works for you!
内容的提问来源于stack exchange,提问作者John Ingles

