Going remote from local repo: Git and forgetting large files

rbatt

I'm a relative git newbie, as you're about to see. So please forgive my poor use of git terminology, I'm still learning.

Concise summary of problem: I want to put my local repo on GitHub, but I have some previously-tracked files that are too big.

Background: This morning I had a local repository where all sorts of files were being tracked: R scripts, .RData files, .csv's, etc. I decided I wanted to make my repository publicly available by pushing it to GitHub.

When I tried to push (using git remote add origin https://github.com/me/repo.git followed by git push -u origin master), I realized that some of my large data files were too large for GitHub. I've decided that it would be OK if the .RData files didn't get pushed to GitHub, and weren't tracked by git (although I don't want to delete the files locally). But I can't figure out how to make this happen.

Things I've tried thus far:

  1. First I added .RData files to the .gitignore file. I quickly realized that this does nothing for files that are already being tracked.
  2. I used git rm -r --cached . followed by git commit -am "Remove ignored files", thinking this would help git forget about all of those huge files I just ignored.
  3. Further following the git help page, I tried git commit --ammend -CHEAD, but I still couldn't push.
  4. I attempted to use the BFG, but I didn't get very far with it b/c it apparently didn't find any files larger than 100M. Clearly I was going something wrong, but decided not to pursue further.
  5. Following some tips I found HERE, I then tried git filter-branch --tree-filter 'git rm -r -f --ignore-unmatch *.RData' HEAD. This definitely did something, but I still couldn't push. However, instead of the huge list of too-big files, I am now down to 2 files that are too big (even though other .RData files in the same directory are no longer listed).

After my last git push -u origin master --force, this is the print out in terminal:

Counting objects: 1163, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1134/1134), done.
Writing objects: 100% (1163/1163), 473.07 MiB | 6.80 MiB/s, done.
Total 1163 (delta 522), reused 0 (delta 0)
remote: error: GH001: Large files detected.
remote: error: Trace: 4ce4aa642e458a7a715654ac91c56af4
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File Results/bigFile1.RData is 166.51 MB; this exceeds GitHub's file size limit of 100 M
remote: error: File Results/bigFile2.RData is 166.32 MB; this exceeds GitHub's file size limit of 100 MB
To https://github.com/me/repo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/me/repo.git'

If you haven't guessed, I don't really know what I'm doing ... I'm essentially trying any code snippet I can find, and seeing if it allows me to push. All of my data and files are backed up, so I'm experimenting rather brazenly.

Given that I'm willing to not track the huge .RData files, how do I get my local repo to the point where I can push it to GitHub?

Any help would be very greatly appreciated. Thanks!

lawinslow

I am pretty sure you will just need to remove them from your .git repo history. Not just remove them from the most current version, they need to be excised from ever having existed in your repo.

The technique is covered elsewhere, see this stackoverflow post or the BFG tool.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

List files in local git repo?

From Dev

Check if local git repo is ahead/behind remote

From Dev

Delete dir/files from SVN remote repo without causing local non-versioned copy to be deleted

From Dev

Why does Git show my local "pull from remote" when I push my commit to the remote repo?

From Dev

Git remote repo, not showing the files

From Dev

How to know local repo is different from remote repo, without fetch?

From Dev

Deleted local files automatically remove from git repo?

From Dev

Going remote from local repo: Git and forgetting large files

From Dev

Creating a git repo on a remote server from a local machine

From Dev

How to disconnect local git repo from remote master

From Dev

Merge local git repo with remote one

From Dev

git delete local files but keep files in repo

From Dev

Push local new Git repo to existing remote repo as branch?

From Dev

How to remove a file from git repo on local and remote

From Dev

How to compare local with remote git repo in PhpStorm?

From Dev

Hosting executable .jar files in BitBucket repo or automate packaging executable .jar files from git into local folder

From Dev

Git / GitHub: How to get new local repo into empty remote repo

From Dev

How to compare GIT Remote Repo and local in Netbeans

From Dev

Delete dir/files from SVN remote repo without causing local non-versioned copy to be deleted

From Dev

Bring a local folder to remote git repo

From Dev

Git remote repo, not showing the files

From Dev

Drop remote branch and reset local repo to match remote using GIT

From Dev

git server read files from it's repo(remote)

From Dev

Deleted local files automatically remove from git repo?

From Dev

git not overwriting remote repo with local files?

From Dev

unable to push my local git repo to the remote repo

From Dev

Git - Removing multiple previous commits from both local and remote repo

From Dev

Override local files with Git Pull | Discard all local files and directories and git the complete latest code from the repo

From Dev

Remote Repo name changed in Github, but not reflecting in Local Repo with Git fetch

Related Related

  1. 1

    List files in local git repo?

  2. 2

    Check if local git repo is ahead/behind remote

  3. 3

    Delete dir/files from SVN remote repo without causing local non-versioned copy to be deleted

  4. 4

    Why does Git show my local "pull from remote" when I push my commit to the remote repo?

  5. 5

    Git remote repo, not showing the files

  6. 6

    How to know local repo is different from remote repo, without fetch?

  7. 7

    Deleted local files automatically remove from git repo?

  8. 8

    Going remote from local repo: Git and forgetting large files

  9. 9

    Creating a git repo on a remote server from a local machine

  10. 10

    How to disconnect local git repo from remote master

  11. 11

    Merge local git repo with remote one

  12. 12

    git delete local files but keep files in repo

  13. 13

    Push local new Git repo to existing remote repo as branch?

  14. 14

    How to remove a file from git repo on local and remote

  15. 15

    How to compare local with remote git repo in PhpStorm?

  16. 16

    Hosting executable .jar files in BitBucket repo or automate packaging executable .jar files from git into local folder

  17. 17

    Git / GitHub: How to get new local repo into empty remote repo

  18. 18

    How to compare GIT Remote Repo and local in Netbeans

  19. 19

    Delete dir/files from SVN remote repo without causing local non-versioned copy to be deleted

  20. 20

    Bring a local folder to remote git repo

  21. 21

    Git remote repo, not showing the files

  22. 22

    Drop remote branch and reset local repo to match remote using GIT

  23. 23

    git server read files from it's repo(remote)

  24. 24

    Deleted local files automatically remove from git repo?

  25. 25

    git not overwriting remote repo with local files?

  26. 26

    unable to push my local git repo to the remote repo

  27. 27

    Git - Removing multiple previous commits from both local and remote repo

  28. 28

    Override local files with Git Pull | Discard all local files and directories and git the complete latest code from the repo

  29. 29

    Remote Repo name changed in Github, but not reflecting in Local Repo with Git fetch

HotTag

Archive