git不常见问题处理

169 阅读1分钟

问题一: error: some local refs could not be updated; try running

企业微信截图_1708590752505.png

  • 问题原因:线上库和本地库不同步
  • 解决办法
git remote prune origin

问题二 warning: unable to rmdir 'pack-login': Directory not empty

企业微信截图_e7f2a129-c1d1-491d-8245-6f50b9cc38fb.png

  • 问题原因:本地库因缓存无法同步代码
  • 解决办法
git remote update origin --prune

问题三 hint: Updates were rejected because the tag already exists in the remote.

  • 问题原因:本地标签tag和远程tag出现不一致
// 先在终端执行 获取所有的标签
git pull --tags

// 执行命令 覆盖本地存在的标签冲突
git pull --tags -f