Search code examples
gitgithubgit-lfs

displaying old sha256 value after migrating sources from github


I had a repository called RepoA in GitHub with some large files. I migrated RepoA from GitHub to GitLab.

After that, I cloned RepoA sources from GitLab. If I run

git show file1.tar

I'm getting the following message:

+version https://git-lfs.github.com/****/v1
+oid sha256:*****************hgxs7y726726746881e7*****
+size 96776698
  1. Why am I getting GitHub url here after migrating RepoA to GitLab?
  2. Is there any way to remove GitHub old sha256 value attached to file.tar?

Solution

  • These are pointer files used by Git LFS. Since Git LFS stores large files outside of the main Git data, these files are used to locate the correct data.

    To answer question 1, the URL in the version line is a version identifier, indicating the version of the Git LFS specification, not anything specific to your repository. It's the same for all Git LFS files regardless of where they're hosted.

    To answer question 2, the SHA-256 value of your file has not changed. SHA-256 is a cryptographic hash function used to uniquely identify a file. If the file had a given hash before, it will have the same hash now.

    Note that when you use git show, by default it does not apply smudge or clean filters, such as those used by Git LFS, and will therefore show the pointer file for LFS files. You can view the actual large file by doing this:

    $ git -c diff.lfs.textconv=cat show --textconv file1.tar
    

    However, usually tar files are not text files, so it isn't a good idea to display them to your terminal like that.