I’m totally stumped on a git problem trying to do the initial push from my local repo to github.
In R Studio,
I added .git (usethis::use_git()
) to my project folder, and then ran usethis::use_github()
. It created https://github.com/friendly/6135
but then failed when trying to push.
From the command line, I tried to push directly:
friendly@UIT-HHP-31TRNW1 MINGW64 ~/Dropbox/Documents/6135 (master)
$ git remote -v
origin git@github.com:friendly/6135.git (fetch)
origin git@github.com:friendly/6135.git (push)
friendly@UIT-HHP-31TRNW1 MINGW64 ~/Dropbox/Documents/6135 (master)
$ git push -u origin master
Enumerating objects: 1827, done.
Counting objects: 100% (1827/1827), done.
Delta compression using up to 4 threads
Compressing objects: 100% (1820/1820), done.
remote: fatal: pack exceeds maximum allowed size
fatal: sha1 file '<stdout>' write error: Broken pipe KiB/s
error: remote unpack failed: index-pack abnormal exit
To github.com:friendly/6135.git
! [remote rejected] master -> master (failed)
error: failed to push some refs to 'git@github.com:friendly/6135.git'
My local repo is large, ~ 11.7 Gb, and that seems to be why the push failed. I added some folders to .gitignore
, but that seems not to have any effect.
Can I try manually uploading the local folders to github until they are done? If so, should I also copy the .git folder?
Edit:
Here are the top 10 largest files/folder in the repo. .git
is nearly 4 Gb. I added ./students/
to .gitignore
, but it is presumably in my history. I'd prefer not to wipe out .git
and start over, but will if that is the only simple way.
friendly@UIT-HHP-31TRNW1 MSYS ~/Dropbox/Documents/6135 (master)
$ du -a . | sort -n -r | head -n 10
9582107 .
3964398 ./.git
3964059 ./.git/objects
2866164 ./students
2169492 ./students/2018
1621472 ./students/2018/presentations
1253347 ./_site
773688 ./lectures
773688 ./_site/lectures
527620 ./students/2018/presentations/OrtacOnder_Presentation.mp4
Edit2:
There have been a number of related posts on this topic, suggesting (confusingly) different solutions. For info & to close this: What finally worked for me was:
- Identify a few very large files (>100 Mb), no longer needed and remove them.
- Bite the bullet and
rm -rf .git
(first saving it elsewhere in case I needed to revert). git init
to start overgit add
a few directories at a time,git commit
,git push -u origin master
- rinse, wash, repeat until all folders were pushed