今天运行 git push 命令时,正常执行不报错,但是实际上文件并未上传更新到 github:
$ git push -u origin main
Everything up-to-date
branch 'main' set up to track 'origin/main'.
后来在 stackoverflow 上找到了一个解决办法,试了一下,成功解决,记录一下:
$git push -u origin HEAD:main
Enumerating objects: 86, done.
Counting objects: 100% (86/86), done.
Delta compression using up to 24 threads
Compressing objects: 100% (50/50), done.
Writing objects: 100% (51/51), 14.74 KiB | 7.37 MiB/s, done.
Total 51 (delta 33), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (33/33), completed with 30 local objects.
To https://github.com/www.02405.com/main.git
24351d1..1d09a95 HEAD -> main
区别就是推送独立的 HEAD。