无法更改 git (Enterprise) 远程 url 而不 git 尝试推送未跟踪的目录

Unable to change git (Enterprise) remote url without git trying to push un-tracked directory

我需要托管在 GitLab 上的存储库也托管在 GitHub 企业服务器上。服务器阻止上传超过 100MB 的文件。

我有一个本地 Mongo 数据库,其中包含两个 "prealloc" 文件,每个文件预留 1GB。我删除了父 (data/) 目录(现在使用 MLab 来托管数据库),并停止 git 跟踪 git rm data/。然后我做

git remote set-url origin git@my-enterprise.github.git

这会将来源 url 设置为企业版。然后,当我尝试推送时,它会中止推送以及消息:

remote: error: File data/journal/prealloc.0 is 1024.00 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB

即使目录不见了。它不在 git 的跟踪文件列表中。关于我可能遗漏的任何想法?

Even though the directory has gone. Its not in git's list of tracked files. Any ideas on what I might be missing?

  • 首先,你的历史上还有它。
  • 其次,验证是否已删除:git rm -rf --cached data/ 这将从暂存中删除它,您将必须提交删除。
  • 第三次使用 BFG 工具清理您的存储库 https://rtyley.github.io/bfg-repo-cleaner/