Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i move a repository with LFS support to gitlab.com?

I have a repository on an old githost instance and i'm trying to migrate it over to gitlab.com. I'm using their instructions for migrating, but because this repository uses LFS, i am getting some errors that i cannot figure out how to resolve. Here are the commands I'm running

cd repo
git remote rename origin old-origin
git remote add origin [email protected]:group/repo.git
git push -u origin --all
git push -u origin --tags

And here is a sample of the response i get from git on the first push command:

remote: GitLab: LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".
To https://gitlab.com/group/repo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.com/group/repo.git'

I have tried the suggested command (git lfs push --all) and that command is not valid. I have also tried git lfs push origin master and that results in:

Uploading LFS objects: 100% (29/29), 2.4 GB | 0 B/s, done

I cannot find anything on the Gitlab docs, so i'm asking for this community's help. Thanks!

Edit: I have also tried using https instead of SSH repo origin and that results in no difference.

like image 553
Nicholas Tulach Avatar asked Feb 07 '19 20:02

Nicholas Tulach


People also ask

Does GitLab support LFS?

Not all code hosting services support LFS already. As a GitLab user, however, there's not much to worry about: if you're using GitLab.com or a halfway recent version of GitLab CE or EE, support for LFS is already baked in! Your administrator only need to enable the LFS option.

How do I upload an LFS file to GitHub?

In order to use Git LFS, you'll need to download and install a new program that's separate from Git. Navigate to git-lfs.github.com and click Download. Alternatively, you can install Git LFS using a package manager: To use Homebrew, run brew install git-lfs .


1 Answers

I just attempted to do what you're trying to do.

Did the following:

  • git clone [email protected]:g19fanatic/test_lfs.git cd test_lfs
  • git lfs track *.bin
  • yes "123456678" | head -c 1024000 > test.bin
  • git add .
  • git push origin master
    • saw the file in github, tracked with lfs
  • git remote add gitlab [email protected]:pauldibiase/lfs-test.git
  • git lfs push --all gitlab
    • received the following error: Locking support detected on remote "gitlab". Consider enabling it with: $ git config lfs.https://gitlab.com/pauldibiase/lfs-test.git/info/lfs.locksverify true
  • git config lfs.https://gitlab.com/pauldibiase/lfs-test.git/info/lfs.locksverify true
  • git lfs push --all gitlab
    • Uploading LFS objects: 100% (1/1), 1.0 MB | 0 B/s, done
  • git push gitlab master
    • saw file in gitlab, lfs tracked

FIPS mode initialized

Uploading LFS objects: 100% (1/1), 1.0 MB | 0 B/s, done

Counting objects: 4, done.

Delta compression using up to 16 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (4/4), 416 bytes | 0 bytes/s, done.

Total 4 (delta 0), reused 0 (delta 0)

To [email protected]:pauldibiase/lfs-test.git

  • [new branch] master -> master

Using git --version = git version 1.8.3.1

Using git lfs --version = git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.2; git dc072c3e)

Try to push your actual branch to your new gitlab remote.

like image 127
g19fanatic Avatar answered Sep 29 '22 04:09

g19fanatic