0

I have a branch in github and it has commit which has large file and I used LFS to push that file. I need to push the same branch to another remote (i.e Git Tea), when I try to push the branch it's giving 413 error. Can I get any way so that I could push the branch directly into another remote.

Currently I cloned the two remote branch and just copy & pasting the files from cloned folder to another and then committing the changes separately. I know it's not a good way, but I don't have any other way as well.

  • Status 413 means "too large". You likely need to enable LFS in your second remote or not commit (and push) very large files – knittl Jul 19 '23 at 06:46
  • Thanks for reply @knittl , Can I know how to enable LFS in git. because I'm not pushing any local changes right. I'm just pushing the branch from one remote to another remote. I guess we use LFS only while pushing the data from local changes to any particular branch by creating the ".gitattributes" file. – DevDarkMind Jul 19 '23 at 07:43
  • There are no "local changes" and "remote changes", Git only cares about _commits_. When cloning, you copy all commits to your local computer. When pushing, you copy your local commits to the remote repository. If you have commits with LFS data, all repositories that come in contact with those commits need to support LFS. – knittl Jul 19 '23 at 08:12
  • @knittl, Okay I got your point. But my other repo is empty , how can I enable LFS over there ? – DevDarkMind Jul 19 '23 at 09:58
  • @knittl, Consider I have a repo called "LFS_test_gitlab" and I have a "main" branch within that and I have committed a 250mb file in single commit using LFS. On the other hand I have repo called "LFS_test_github" and It is empty. Now I want to push the same "main" branch from the "LFS_test_gitlab" into this repo. How can I do that ? As of now I'm using Fork tool, and I cloned the "LFS_test_gitlab" into my local system, and I added one more remote(i.e "LFS_test_github") in fork. Now I tried to push the "main" branch directly into other remote. but I'll get 413 error. – DevDarkMind Jul 19 '23 at 10:07
  • @knittl. What did I miss over here ? Can you explain the solution in brief ? – DevDarkMind Jul 19 '23 at 10:09
  • https://docs.github.com/en/repositories/working-with-files/managing-large-files/configuring-git-large-file-storage and https://docs.github.com/en/repositories/working-with-files/managing-large-files/installing-git-large-file-storage. I have never used Git LFS myself, but the error clearly indicates that your files are too big – knittl Jul 19 '23 at 10:09
  • Yess @knittl that large file error can be resolved using LFS while committing, but in my case that large files are already committed & pushed to one branch , i'm just pushing that branch into another remote. – DevDarkMind Jul 19 '23 at 10:20
  • Then you cannot push this commit to GitHub. For large files you _must_ LFS if you want to use GitHub (and your question suggested that you were already using LFS: »I have a branch in github and it has commits which has LFS files. I need to push the same branch to Git Tea remote«). Removing large files: https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-the-git-repository – knittl Jul 19 '23 at 10:25
  • Okay @knittl, Thanks for the suggestions. – DevDarkMind Jul 19 '23 at 10:33

0 Answers0