[英]How to upload files to Colab from Github without using Google Drive?
[英]How to upload large files from Colab to GitHub?
我正在嘗試將大文件從 Colab 上傳到 GitHub:
我安裝 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.
更改當前文件夾並克隆 git:
%cd /content/checkpoints/train
!git clone https://{username}:{password}@github.com/{username}/{project}.git
軌道文件夾:
!git lfs track "/content/checkpoints/train"
添加文件並檢查狀態:
!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
做承諾:
!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
更改緩沖區大小:
!git config --global http.postBuffer 3145728000
並推動:
!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
我該如何解決這個錯誤?
我試圖在推送之前添加這些行:
!export GIT_TRACE_PACKET=1
!export GIT_TRACE=1
!export GIT_CURL_VERBOSE=1
但這並沒有改變任何東西。
不要閱讀下面的內容,該網站寫道: 看起來你的帖子主要是代碼; 請添加更多詳細信息。
安裝 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.