Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicating a git repository and its GIT-LFS settings

I've duplicated a repo into a newer repo but when doing a git clone on the new repo it's unable to download the files using the LFS pointers and I get an error when smudge is used... e.g... "Error downloading object. Object not found on server"

Steps:

git clone --bare https://github.com/myuser/old-repo.git
cd old-repository.git
git push --mirror https://github.com/myuser/new-repo.git

git clone https://github.com/myuser/new-repo.git
[error.....git-lfs.exe smudge --- somefile.....Error downloading object]

The branches and commit histories look fine but LFS fails to download the required files. Is there another method when using git-lfs?

like image 602
JoeCoder Avatar asked Jul 11 '16 20:07

JoeCoder


People also ask

How do I clone a git repository with LFS?

Once Git LFS is installed, you can clone a Git LFS repository as normal using git clone . At the end of the cloning process Git will check out the default branch (usually main ), and any Git LFS files needed to complete the checkout process will be automatically downloaded for you.

What is the difference between git and git LFS?

Git LFS is a Git extension used to manage large files and binary files in a separate Git repository. Most projects today have both code and binary assets. And storing large binary files in Git repositories can be a bottleneck for Git users. That's why some Git users add Git Large File Storage (LFS).

How do I copy a git repository from one account to another?

On GitHub.com, navigate to the main page of the repository. Under your repository name, click Settings. Under "Danger Zone", click Transfer. Read the information about transferring a repository, then type the name of the user or organization you'd like to transfer ownership of the repository to.


2 Answers

I found out this link: mirroring-a-repository-that-contains-git-large-file-storage-objects

It seems to exactly answer your question. The important part you missed is the git lfs push/pull:

git clone --bare https://hostname/exampleuser/old-repository.git
cd old-repository.git
git lfs fetch --all
git push --mirror https://hostname/exampleuser/new-repository.git
git lfs push --all https://github.com/exampleuser/new-repository.git
like image 160
Chananel P Avatar answered Oct 20 '22 07:10

Chananel P


Hooks and addons and such are repo-local config, if your git-lfs setup is somehow tricky to do a second time commit a repo-setup script to do it and run that on first checkout.

like image 2
jthill Avatar answered Oct 20 '22 06:10

jthill