'How to upload large files from Colab to GitHub?
I'm trying to upload large files from Colab to GitHub:
I install LFS:
!curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
!sudo apt-get install git-lfs
!git lfs install
Detected operating system as Ubuntu/bionic.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/github_git-lfs.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
git-lfs
0 upgraded, 1 newly installed, 0 to remove and 139 not upgraded.
Need to get 5,740 kB of archives.
After this operation, 14.0 MB of additional disk space will be used.
Get:1 https://packagecloud.io/github/git-lfs/ubuntu bionic/main amd64 git-lfs amd64 2.8.0 [5,740 kB]
Fetched 5,740 kB in 0s (13.2 MB/s)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:
Selecting previously unselected package git-lfs.
(Reading database ... 131187 files and directories currently installed.)
Preparing to unpack .../git-lfs_2.8.0_amd64.deb ...
Unpacking git-lfs (2.8.0) ...
Setting up git-lfs (2.8.0) ...
Git LFS initialized.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Git LFS initialized.
Change current folder and clone git:
%cd /content/checkpoints/train
!git clone https://{username}:{password}@github.com/{username}/{project}.git
Track folder:
!git lfs track "/content/checkpoints/train"
Add files and check status:
!git add "/content/checkpoints/train"
!git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .gitattributes
new file: train/checkpoint
new file: train/ckpt-1.data-00000-of-00002
new file: train/ckpt-1.data-00001-of-00002
new file: train/ckpt-1.index
new file: train/ckpt-2.data-00000-of-00002
new file: train/ckpt-2.data-00001-of-00002
new file: train/ckpt-2.index
new file: train/ckpt-3.data-00000-of-00002
new file: train/ckpt-3.data-00001-of-00002
new file: train/ckpt-3.index
new file: train/ckpt-4.data-00000-of-00002
new file: train/ckpt-4.data-00001-of-00002
new file: train/ckpt-4.index
Do commit:
!git commit -m "Uploaded checkpoints"
[master df06e11] Upload checkpoints
14 files changed, 12 insertions(+)
create mode 100644 .gitattributes
create mode 100644 train/checkpoint
create mode 100644 train/ckpt-1.data-00000-of-00002
create mode 100644 train/ckpt-1.data-00001-of-00002
create mode 100644 train/ckpt-1.index
create mode 100644 train/ckpt-2.data-00000-of-00002
create mode 100644 train/ckpt-2.data-00001-of-00002
create mode 100644 train/ckpt-2.index
create mode 100644 train/ckpt-3.data-00000-of-00002
create mode 100644 train/ckpt-3.data-00001-of-00002
create mode 100644 train/ckpt-3.index
create mode 100644 train/ckpt-4.data-00000-of-00002
create mode 100644 train/ckpt-4.data-00001-of-00002
create mode 100644 train/ckpt-4.index
Change buffer size:
!git config --global http.postBuffer 3145728000
And push:
!git push origin master
tcmalloc: large alloc 3145728000 bytes == 0x55e488388000 @ 0x7fb6c94b11e7 0x55e485b4a825 0x55e485ad273f 0x55e485ad4579 0x55e485ad21ca 0x7fb6c857bb97 0x55e485ad221a
Counting objects: 17, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (17/17), 2.22 GiB | 58.29 MiB/s, done.
Total 17 (delta 3), reused 4 (delta 0)
error: RPC failed; curl 55 Failed sending data to the peer
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
How can I fix this error?
I tried to add these lines before push:
!export GIT_TRACE_PACKET=1
!export GIT_TRACE=1
!export GIT_CURL_VERBOSE=1
But it didn't change anything.
Don't read below, this site writes: It looks like your post is mostly code; please add some more details.
Solution 1:[1]
Write this command in a Google Clab cell:
!apt-get install git-lfs=2.13.3
This worked for me. The documentation: link
Solution 2:[2]
Install git-lfs
!curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
!sudo apt-get install git-lfs
!git lfs install
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Henry Ecker |