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

 

找个100MB以上的大文件Adobe_Premiere_Pro_CC.7z.

 

(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git lfs track "*.7z"
Tracking "*.zip"
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git add .gitattributes
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git add Adobe_Premiere_Pro_CC.7z 
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ 
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git commit -m "Add design file"
[master (root-commit) 2ed950e] Add design file
 2 files changed, 1 insertion(+)
 create mode 100644 .gitattributes
 create mode 100755 Adobe_Premiere_Pro_CC.7z
(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git push origin master
Locking support detected on remote "origin". Consider enabling it with:
  $ git config lfs.https://git.coding.net/appleyuchi/RSNA_MODEL.git/info/lfs.locksverify true
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 160.32 MiB | 1.31 MiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://git.coding.net/appleyuchi/RSNA_MODEL.git
 * [new branch]      master -> master

#------------------------------------- 下面是clone-------------------------------------------------

(python3.6) appleyuchi@ubuntu:RSNA_MODEL$ git clone https://coding.net/u/appleyuchi/p/RSNA_MODEL
Cloning into 'RSNA_MODEL'...
warning: redirecting to https://git.coding.net/u/appleyuchi/p/RSNA_MODEL/
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
Unpacking objects:  75% (3/4)   
remote: Total 4 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (4/4), done.

 

最后会发现文件被顺利下载了。

目前已经405了

用法参考[1],似乎现在只有付费的用户才支持了。

#----------------------------------------------------------------------------------------------

补充:

上述方法在github通过,

coding经过上面的测试,已经变成付费的了。

gitee根据[2]中开发人员的回复,目前只能是付费企业才支持lfs

Reference:

[1]https://coding.net/git/lfs

[2]https://gitee.com/oschina/git-osc/issues/ILIZL?from=project-issue

 

你可能感兴趣的:(Git)