Convert existing repository in gitea to one using git-lfs

I’m trying to convert my existing gitea git repo with large files to a git repo using git-lfs.
I’ve got all the settings on the gitea side setup to use git-lfs.

I used following instructions to clone and convert the repo:
https://docs.gitlab.com/ee/topics/git/migrate_to_git_lfs/index.html

But the end result is that the files have been replaced with .REMOVED.git-id.

What am I doing wrong or what are the correct steps?

hmm i can confirm problems with converting repo to lfs enabled one…

i sucessfully managed to convert by:

follwing https://confluence.atlassian.com/bitbucket/use-bfg-to-migrate-a-repo-to-git-lfs-834233484.html

and push it to a new repo

@pommetjehorlepiep created https://github.com/go-gitea/gitea/issues/10031

@6543 I tried your suggestion, but no luck there either.

I tried this:

- git clone --mirror <remote repo>
- bfg --strip-blobs-bigger-than 5M --no-blob-protection <local directory remote repo was cloned in>
- cd into directory
- git lfs install
- git push --mirror <newly created gitea repo>

I get this:

Locking support detected on remote "http://..../test.git". Consider enabling it with:
  $ git config lfs.http://..../test.git/info/lfs.locksverify true
ref master:: Error in git rev-list --stdin --objects --not --remotes=http://..../test.git --: exit status 128 fatal: bad object 30d6b1f106e739449c1179ec976c809f86381dcf

error: failed to push some refs to 'http://..../test.git'

According to git the object with SHA 30d6… does not exist locally…

  • git lfs install
  • git push

worked for me (without the --mirror)

It’s been a while, but I finally had some time to look further into this and try out your suggestion.

But I was not really satisfied with the end-result of bfg so I spend some time looking at other alternatives/suggestions of other people.

Tried out a few options, but in the end I settled for git-lfs-migrate.

The working solution is as followed (assuming git-lfs has been installed):

  • git clone --mirror <your existing gitea git repo>
  • cd <local directory of your cloned git repo>
  • git lfs migrate import --everything --include=‘<files/folders to migrate to LFS here>’

Example: --include=‘.xz,.zip,file1,folder1/*’

  • git reflog expire --expire=now --all && git gc --prune=now --aggressive

At this point work is done locally. Now the push to gitea:

  • !!!Backup database, gitea files etc in case something stuff up!!!
  • Create a new repository in Gitea! (You get the ‘bad object’ error otherwise)
  • git remote set-url origin <your new gitea repository url here>
  • git push

And that’s it!

Thanx for your help @6543!

1 Like