测试开源 git-lfs server

期待git对大文件的支持很长时间了.今天GitHub终于放出方案.


我们直接来测试 ,

 1.go get 下 lfs test server 的源代码 然后修改config.go

```

Scheme      string `config:"http"`

AdminUser   string `config:"admin"`

AdminPass   string `config:"admin"`

```

2.go build  and run 

我们进入 http://localhost:8080/mgmt/   

创建一个user1 


3.修改.git目录里的config增加官方说的

```

[lfs]

  url = "http://localhost:8080/user1/repo"

```

4.按照官方教程 https://git-lfs.github.com/  

```

git lfs track "*.psd"

git add file.psd

git commit -m "Add design file"

git push origin master

```

最后控制台会输出 

```

Username for 'http://localhost:8080': user1

Password for 'http://user1@localhost :8080':

14.65 MB / 14.65 MB [======================================

ounting objects: 11, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (11/11), done.

Writing objects: 100% (11/11), 1.40 KiB | 0 bytes/s, done.

Total 11 (delta 3), reused 0 (delta 0)

To https://github.com/rocklau/TestLargeFiles.git

``` 

5.恭喜成功从git剥离大文件 (检查 http://localhost:8080/mgmt/objects 以及 lfs-context目录 )

而github里的file.psd的内容现在就是这样.

```

version https://git-lfs.github.com/spec/v1

oid sha256:df4691a995704bf0d286064a7e177c06300c8402f6082022c378f2fe9b12a54c

size 15357931


```


这里围观

https://github.com/rocklau/TestLargeFiles


原文在此 :https://github.com/rocklau/blog/issues/3



你可能感兴趣的:(github,git-lfs)