2016-07-14 94 views
2

我現有的Github回購臃腫的zip和tar.gz文件,因此我想將其遷移到新的 Git LFS啓用的回購與現有Github回購分開測試,以便現有的Github回購是原封不動。我遇到了一個叫做bfg-repo-cleaner https://github.com/rtyley/bfg-repo-cleaner的美妙工具,看起來正是我所需要的!將現有Git回購遷移到新的Git LFS已啓用回購

我編譯了我認爲我需要做的步驟,但是會喜歡第二雙眼睛以確保這些步驟是正確的。

如果原來已有的回購是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回購還爲gitlab和bitbucket和備份位置添加了額外的遙控器。我相信bitbucket和gitlab都支持像github一樣的Git LFS嗎?

乾杯

+1

BitBucket只支持自2016年7月18日起的LFS:http://stackoverflow.com/a/38450750/6309 – VonC

回答