将项目推送到 Git Hub 并且不能

Push the project into Git Hub and can't

我正在尝试将我的项目推送到我在 GitHub 的存储库中,在写入之前一切正常

Git push origin main

花了很长时间,然后显示此错误:

Enumerating objects: 3739, done.
Counting objects: 100% (3739/3739), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2910/2910), done.
Writing objects: 100% (3738/3738), 52.08 MiB | 5.83 MiB/s, done.
Total 3738 (delta 1554), reused 0 (delta 0), pack-reused 0
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date

我写的所有命令:

git 初始化

git 添加 .

git commit -m "新变化"

git push origin main

谁知道是什么问题?

首先,生成ssh key,按照这篇文章:

https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/

如果无法正常工作,请检查您的网络连接稳定性。

如果网络连接没有问题,请尝试其他解决方案。它可能有效:

---On Linux---

在执行Git命令之前在命令行中执行以下命令:

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

---On Windows---

在执行Git命令之前在命令行中执行以下命令:

set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

另外:

git config --global core.compression 0
git clone --depth 1 <repo_URI>
# cd to your newly created directory
git fetch --unshallow 
git pull --all

正如科迪布朗所说:

---For PowerShell users---

$env:GIT_TRACE_PACKET=1
$env:GIT_TRACE=1
$env:GIT_CURL_VERBOSE=1