首页 > 解决方案 > 无法在 git 尝试推送未跟踪目录的情况下更改 git(企业)远程 url

问题描述

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

我有一个本地 Mongo 数据库,其中包含两个“prealloc”文件,每个文件留出 1GB。我删除了父 (data/) 目录(现在使用 MLab 来托管数据库),并使用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 的跟踪文件列表中。关于我可能遗漏的任何想法?

标签: gitgithubgitlabgithub-enterprise

解决方案


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

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

推荐阅读