You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git 1.9.5版本可执行pull但无法push/fetch问题求助

Fixing Push/Fetch Failures in Git 1.9.5 (When Pull Works)

Hey there, sorry to hear you're hitting this frustrating issue—pull works fine, but push/fetch suddenly stopped? Let's walk through the most likely fixes, since this usually ties back to authentication, remote config, network quirks, or even your older Git version's limitations.

1. Check Authentication First (Most Common Culprit)

Pull might work anonymously or with cached credentials, but push/fetch often requires valid, up-to-date auth.

  • Verify remote URLs: Run git remote -v to make sure your push and pull URLs match. Sometimes a misconfiguration (e.g., pull uses HTTPS but push uses SSH, or vice versa) can break authentication. If they don't align, update the push URL with git remote set-url origin <correct-repo-url>.
  • Refresh HTTPS credentials: Git 1.9.5's credential cache can expire or get corrupted.
    • On Windows: Run git config --global credential.helper wincred—next time you push, it'll prompt for your username/password again.
    • On Linux/macOS: Use git config --global credential.helper cache to reset the cache, or manually delete stored credentials (e.g., in macOS Keychain, search for entries labeled "git").
  • Troubleshoot SSH keys: If you're using SSH, test the connection with ssh -T git@<your-remote-host> (replace with your repo host like github.com). If you get an error:
    • Check key permissions: Run chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_rsa—strict permissions are required for SSH to work.
    • Regenerate and re-add the key: If your key is expired or invalid, create a new one with ssh-keygen -t rsa -b 4096 and add the public key to your remote repo's SSH settings.

2. Fix Remote Branch Tracking Issues

Sometimes the link between your local branch and the remote branch breaks unexpectedly.

  • Check tracking status: Run git branch -vv—look for the remote branch next to your local branch (e.g., * master abc123 [origin/master]). If it's missing or shows an error, re-set the tracking:
    git branch --set-upstream-to=origin/<remote-branch-name> <local-branch-name>
    
  • Validate remote existence: Run git remote show origin—if you get "remote origin does not exist", re-add the remote with git remote add origin <your-repo-url>.

3. Rule Out Network/Firewall Problems

A sudden change in your network (like a new firewall rule or proxy) can block push/fetch traffic even if pull works.

  • Test port connectivity: For SSH, run telnet <your-remote-host> 22; for HTTPS, run telnet <your-remote-host> 443. If the connection fails, your network is likely blocking that port—contact your admin or switch protocols (SSH ↔ HTTPS) to work around it.
  • Clear invalid proxy settings: If Git was using a proxy that's now offline, remove it:
    git config --global --unset http.proxy
    git config --global --unset https.proxy
    

4. Work Around Git 1.9.5's Limitations

Git 1.9.5 is pretty old (released in 2014), so it might not support modern repo security features.

  • Enable legacy SSH algorithms: If your remote repo disabled older algorithms like RSA SHA-1 (common on platforms like GitHub), add this to your ~/.ssh/config file:
    Host <your-remote-host>
        HostkeyAlgorithms +ssh-rsa
        PubkeyAcceptedAlgorithms +ssh-rsa
    
  • Consider upgrading (if possible): While you might be stuck on 1.9.5 for compatibility, upgrading to a newer version (even 2.x) would fix many known auth and protocol issues.

If none of these work, share the exact error message you get when running git push or git fetch—that'll help narrow down the problem even more!

内容的提问来源于stack exchange,提问作者Andre Rubnikowich

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:34:14