6

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 git@gitlab.com: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.

Nicholas Tulach
  • 713
  • 1
  • 7
  • 23
  • 1
    How about pushing --mirror? `git lfs push --mirror /remoteOnGitlab` like in this post? https://stackoverflow.com/questions/47528550/updating-and-repairing-lfs-when-migrating-repositories-from-github-to-selfhosted – g19fanatic Feb 11 '19 at 21:59
  • How did you setup lfs for your project on gitlab.com ? – LeGEC Feb 12 '19 at 08:37
  • @g19fanatic Thank you. I did try these instructions, but they seem somewhat outdated and do not work. Specifically the final `git lfs push --mirror` command is no longer available. I tried without the `--mirror` option and i tried `git push --mirror …` and neither worked. – Nicholas Tulach Feb 12 '19 at 13:40
  • @LeGEC I enabled git lfs support via the toggle switch on the `General Settings > Permissions` page for the new project i'm trying to push to. – Nicholas Tulach Feb 12 '19 at 13:41

1 Answers1

2

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

Did the following:

  • git clone git@github.com: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 git@gitlab.com: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 git@gitlab.com: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.

g19fanatic
  • 9,329
  • 6
  • 30
  • 60