0

I try to upload my code to GitHub using LFS and face a problem below

problem description

below is the code I have ran

git init

git install lfs

git lfs migrate import --include="*.tres"

However, I get a error like below

migrate: override changes in your working copy?  All uncommitted changes will be lost! [y/N] y
migrate: changes in your working copy will be overridden ...
Git can't resolve ref: "HEAD"

My attempts to solve the problem:

  1. I have checked this answer(git status shows fatal: bad object HEAD) saying that some git data is lost. I believe it is not the case for me because I am not yet linking it to a remote repo.
  2. I also tried the command git fsck --full and get the output below
    Checking object directories: 100% (256/256), done. 
    notice: HEAD points to an unborn branch (main) 
    notice: No default reference

I find it strange because the branch is main instead of the master so I think if it is the case - I do not change the name of the branch

  1. I try to copy and paste all files into a new folder (without git files) and run these commands again but the problem is still there when files can run smoothly.
torek
  • 448,244
  • 59
  • 642
  • 775
hanzi
  • 21
  • 4
  • 4
    When you initialize your repository, you have to create an initial commit so `HEAD` is pointing to something. – Jeff Mercado Aug 23 '22 at 04:42
  • Furthermore, `git lfs migrate` is about replacing *existing commits* with new and "improved" commits in which the large files have been replaced with pointer files (so that the Git repostiory no longer contains the large files at all). Given that a new, empty repository *has no commits*, there is by definition *nothing to migrate*. – torek Aug 23 '22 at 20:59

0 Answers0