You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用git-filter-repo后仍无法迁移Bitbucket仓库至GitHub的解决方法

解决方法

1. 补充过滤遗漏的大文件路径

你之前仅处理了_pre/.terraform路径,但报错显示database/.terraform下仍存在超规大文件,需要将两个路径同时纳入过滤范围,彻底清除历史提交中的相关文件:

git filter-repo --invert-paths --path _pre/.terraform* --path database/.terraform*

2. 验证历史清理结果

执行过滤后,通过以下命令确认目标大文件已从所有分支、标签的历史中移除:

# 检查_pre路径下的大文件是否还在历史中
git log --all -- _pre/.terraform/plugins/registry.terraform.io/hashicorp/aws/3.37.0/windows_amd64/terraform-provider-aws_v3.37.0_x5.exe
# 检查database路径下的大文件是否还在历史中
git log --all -- database/.terraform/plugins/registry.terraform.io/hashicorp/aws/3.44.0/windows_amd64/terraform-provider-aws_v3.44.0_x5.exe

若命令无输出,说明历史已清理干净。

3. 强制推送所有分支和标签

由于修改了仓库历史,需要强制覆盖GitHub远程仓库的内容:

# 推送所有分支
git push --force origin 'refs/heads/*'
# 推送所有标签
git push --force origin 'refs/tags/*'

4. 避免后续重复问题

在仓库根目录创建.gitignore文件,添加以下规则,防止Terraform相关文件被误提交:

# Terraform忽略规则
.terraform/
*.tfstate
*.tfstate.*

确保所有协作成员同步该文件。

内容的提问来源于stack exchange,提问作者Moribundus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 11:35:08