git push:解决https网络问题
·
方案一:改用 SSH 推送(最稳定,推荐)
ssh-keygen -t ed25519 -C "你的GitHub邮箱"//生成 SSH 密钥(如果还没有)
cat ~/.ssh/id_ed25519.pub//复制公钥内容
//登录 GitHub → 头像 → Settings → SSH and GPG keys → New SSH key,粘贴公钥保存
git remote remove origin// 删除旧的远程关联
git remote add origin git@github.com:AvrilJF/RAG.git//修改远程地址为 SSH
git push -u origin main//重新推送
方案二:用 PAT 认证 + 调整网络配置
生成 GitHub Personal Access Token(PAT):
进入 GitHub → Settings → Developer settings → Personal access tokens → Generate new token
勾选 repo 权限,生成后复制保存好(只显示一次)
推送时,用户名填 GitHub 账号,密码填这个 PAT。
也可以尝试增大 Git 缓冲区和超时时间:
git config --global http.postBuffer 524288000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
如果你有代理,可以配置 Git 使用代理:
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
更多推荐


所有评论(0)