How to upload large files to GitHub repository
In GitHub regarding how to push large files to your GitHub repository.
GitHub does not allow us to upload files larger than 25 megabytes through the browser. If you try you may get an error as follows.
Nevertheless, you can push larger files into your GitHub repository using the git bash terminal as follows, in just 7 steps.
Step 01
Download and install Git on your pc.
Download link:- https://git-scm.com/downloads
Step 02
Then download and install GitLFS on your pc.
Download link: https://git-lfs.github.com/
Step 03
Now clone your GitHub repository to your local machine.
For this,
First go to your repository and copy the ‘clone/download’ URL.
Next, create a new folder in your pc wherever you prefer: this is to clone the copy of your GitHub repository to your pc.
Then right-click the background and click ‘Git Bash Here’ as follows.
Then run the following command in the bash terminal opened.
$ git clone link you copied
Eg:- $ git clone https://github.com/Newuser/NewRepository.git
Close the bash terminal and, now you have successfully cloned your GitHub repository to your local machine.
Step 04
Go to inside the cloned repository. (If you want to upload the file to another folder already created inside the repository, then go to that folder)
Right-click the background and again click ‘Git Bash Here’.
Run the following command
$ git lfs track “.fileextension”Eg: If I want to upload a pdf file, then
$ git lfs track “.pdf”
Step 05
Then copy the file you want to upload, into repository or folder in the repository.
Step 06
Then run the command,
$ git add filename.fileextensionEg:- $ git add TheGuid.pdf
Step 07
Now run the following command.
$ git commit -m "commit message"Eg:- $ git commit -m “add TheGuid.pdf”
Next run,
$ git push origin master
This command will start the uploading the file
You will notice the progress of the uploading in the bash terminal,After uploading is finished, you may notice the file is uploaded to your GitHub repository, successfully.
Thanks for Reading🤩