将现有Git repo迁移到新的启用Git LFS的repo

将现有Git repo迁移到新的启用Git LFS的repo,git,github,git-rewrite-history,bfg-repo-cleaner,Git,Github,Git Rewrite History,Bfg Repo Cleaner,我现有的Github repo中的zip和tar.gz文件越来越多,因此我想将其迁移到一个新的Git LFS启用的repo,该repo独立于现有的Github repo进行测试,以便现有的Github repo不受影响。我遇到了一个很棒的工具叫bfg回购清理器,看起来正是我需要的 我编译了我认为我需要做的步骤,但是我希望有第二双眼睛来确保这些步骤是正确的 原始现有回购协议为https://github.com/username/source.git和新目标Git LFS启用的回购是https:/

我现有的Github repo中的zip和tar.gz文件越来越多,因此我想将其迁移到一个新的Git LFS启用的repo,该repo独立于现有的Github repo进行测试,以便现有的Github repo不受影响。我遇到了一个很棒的工具叫bfg回购清理器,看起来正是我需要的

我编译了我认为我需要做的步骤,但是我希望有第二双眼睛来确保这些步骤是正确的

原始现有回购协议为<代码>https://github.com/username/source.git和新目标Git LFS启用的回购是
https://github.com/username/destination-lfs.git

pass=PERSONAL_ACCESS_TOKEN
ORIGINAL="https://github.com/username/source.git"
REPONAME_ORIGINAL='source.git'
NEW="https://username:"${pass}"@github.com/username/destination-lfs.git"
REPONAME_NEW='destination-lfs.git'

# setup local work space
mkdir -p /home/workgit
cd /home/workgit

# download bfg
wget -cnv http://repo1.maven.org/maven2/com/madgag/bfg/1.12.12/bfg-1.12.12.jar -O bfg.jar
alias bfg='/bin/java -jar bfg.jar'

# setup local git
git clone --mirror "$ORIGINAL" "$REPONAME_NEW"
cd $REPONAME_NEW
git count-objects -v
git remote rename origin upstream
git remote add origin $NEW
git remote -v
cd ../

time bfg --convert-to-git-lfs '*.{zip,gz,rpm,tgz,xz,bz2,rar,7z,pdf,eot,svg,ttf,woff,woff2}' --no-blob-protection $REPONAME_NEW

cd $REPONAME_NEW
git reflog expire --expire=now --all && git gc --prune=now --aggressive
git count-objects -v
git lfs init
git push --dry-run -u origin master
git push -u origin master
我错过什么了吗?看来推动也失败了

git push --dry-run -u origin master                                        
Git LFS: (76 of 43 files) 799.22 MB / 1.43GB                                                                                                                                                                        
Authorization error: https://github-cloud.s3.amazonaws.com/xxxx/media/*****?actor_id=xxxxxx
Check that you have proper access to the repository
error: failed to push some refs to 'https://username:"${pass}"@github.com/username/destination-lfs.git'
另外,原始的github repo还为gitlab和bitbucket以及备份位置添加了额外的远程设备。我相信bitbucket和gitlab都像github一样支持Git LFS

欢迎Git LFS团队作为首选迁移工具:

git lfs迁移现在是首选的方式。你不应该再需要过滤器分支了。。。我希望


BitBucket仅从2016年7月18日起支持LFS: