Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert exsisting git repository to git-lfs

I am acctualy trying to convert my git repository to git-lfs. I downloaded the bitbucket test server, created a repository and enabled lfs in the options of the repo and the server. If i call git-lfs to track "*.psd" files, it works fine. If i push .psd files they are stored in the git lfs location.The problem is, if i push an exsisting repository(clientside) into an empty git-lfs repo, the files are not stored inside the git-lfs storage. However, if i push another .psd file after that, it works fine.

Do you guys have a good idea how to conver my repo to git-lfs ? I have to keep the history etc. as it is. I also saw some guides on that, but nothing rly worked vor me. I was looking at git-lfs-migrate, another script and some other things. Nothing of this was pushing the tracked files to the lfs dir. directory

Thanks for helping me out !

Frossy

like image 379
Frossy Avatar asked Feb 02 '16 23:02

Frossy


1 Answers

The issue you're having is that when you execute git lfs track *.psd, that only affects what happens to Photoshop files that you subsequently use git add on - either modifications to existing files or new files. Anything that has already been committed will remain as-is, embedded within the Git repo itself.

It is possible to convert your repository history and extract the large file content out of Git and into LFS, but this will inherently require changing the Git history. In practice this means it's best for everyone using this repo to clone a fresh copy after you perform the conversion. Obviously, make backups and co-ordinate with any team members you may have :)

Although I've only done small tests myself, the BFG Repo Cleaner seems to have been successful for a lot of people; you've probably seen this in the threads you've read although there was quite a lot of other noise. There are specific instructions for converting to LFS here: https://github.com/rtyley/bfg-repo-cleaner/releases/tag/v1.12.5

HTH

like image 56
Steve Streeting Avatar answered Oct 15 '22 15:10

Steve Streeting