Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload large amount of files to github

I've seen numerous guides on how to push large files to github, but not how to push a large amount of files.

I have a folder on my desktop that has 600 MB worth of text files that I need to push to a github repository.

I can't upload them directly b/c they exceed github's limitations. I have also tried to upload them from git bash:

$ git init
$ git add .
$ git commit -m “First commit”
$ git remote add origin remote repository URL
$ git push origin master

But this doesn't run, and even if it did, I believe it would just upload all of the files directly into the repository.

Ideally, I have a repository with a separate folder inside of it, and I need to push all 600 MB worth of files into this folder.

Please let me know how I can best go about achieving this!

like image 928
willschrepf Avatar asked Dec 09 '25 06:12

willschrepf


2 Answers

Consider using Git LFS which stores the large files, usually used for binary files, in a folder away from the repository.

A link is included below,

https://docs.github.com/en/free-pro-team@latest/github/managing-large-files/versioning-large-files

like image 140
Shaqil Ismail Avatar answered Dec 11 '25 21:12

Shaqil Ismail


Open terminal on the same project directory write

$ git lfs install

Git LFS will be initialized, after that command.

Track the file by using this command, for example your large file is a gif file.

$ git lfs track "*.gif"
Tracking "*.gif"

$ git add .gitattributes

Then add the files you need to commit, for example.

$ git add public/assets/sample.gif

Then commit

$ git commit -m "Added large file"

For instance you are in the master branch

$ git push origin master

Reference: https://guide.ncloud-docs.com/docs/en/sourcecommit-use-lfs

like image 37
Philanthropist Avatar answered Dec 11 '25 20:12

Philanthropist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!