1、在gitlab上创建空的文件 2、设置->仓库->受保护分支->允许强制推送 3、移除已经存在的远程链接 git remote rm origin 4、推送git push -uf origin main