Errors
C:\RajeshAll\github\ppt>git push origin master
Enumerating objects: 750, done.
Counting objects: 100% (694/694), done.
Delta compression using up to 8 threads
Compressing objects: 100% (584/584), done.
Writing objects: 100% (634/634), 606.82 MiB | 2.37 MiB/s, done.
Total 634 (delta 157), reused 15 (delta 1), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (157/157), completed with 42 local objects.
remote: error: Trace: f7d8654f7202cd414ba887663661bdefcad7e457d2abeecfdeb2a7777bdc31a1
remote: error: See https://gh.io/lfs for more information.
remote: error: File azure/slides/azure-getting-started/Session-1.pdf is 425.95 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To github.com:rajeshkumarin/ppts.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'github.com:rajeshkumarin/ppts.git'
Solution
To remove Session-1.pdf from your commit in Git, follow these steps:
Revert the Commit: If the commit containing Session-1.pdf has not been pushed to the remote repository, you can use the following command to undo this commit while keeping the changes in your working directory:
$ git reset --soft HEAD~1
This command will move the current HEAD back to the previous commit, but keep the changes in your staging area.
Remove the File: Once the commit is undone, you need to remove the file from the staging area:
$ git reset HEAD azure/slides/azure-getting-started/Session-1.pdf
This command unstages Session-1.pdf but leaves it in your working directory.
Commit Again: Now, commit your changes again, excluding Session-1.pdf:
$ git commit -m "Your commit message"
Deal with the File Separately: If you still need to track Session-1.pdf but it is too large for GitHub, consider using Git Large File Storage (LFS). Install Git LFS and then set up LFS for your file types:
$ git lfs install
$ git lfs track "*.pdf"
$ git add .gitattributes
After setting up Git LFS, add your large file:
$ git add azure/slides/azure-getting-started/Session-1.pdf
git commit -m "Add large file with LFS"
Push Your Changes: Finally, push your changes to the remote repository:
$ git push origin master
Latest posts by rajeshkumar (see all)
- SonarQube Error: Error status returned by url [https://api.sonarcloud.io - September 5, 2024
- AWS SES Errors and Solution - September 2, 2024
- SRE Foundation Certification - August 29, 2024