所以我在VSTS中做了一个LFS概念的证明,有一个不寻常的问题我很难证明它做了该做的事基本上,我是按照说明添加.gittattributes文件的
.gittattributes的内容
*.pdf filter=lfs diff=lfs merge=lfs -text
然后我在根目录中添加了一个pdf文件并提交
git add ./3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
git commit -m "some comment"
output: [Master_Copy_LFSTest 738f4a6] some comment
1 file changed, 3 insertions(+)
create mode 100644 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
现在,我确实有了local.git\lfs\objects\xx\xx\bunchoftext,它看起来确实是我的文件,通过移动和重命名回pdf并打开进行了测试。
但是,在本地repo根目录中仍然有完整的文件,而不是3行指针文件。现在我推动回购协议。
git push origin Master_Copy_LFSTest
Locking support detected on remote "origin". Consider enabling it with:
$ git config
lfs.https://xxxxxxxx.visualstudio.com/xxxxxx/_git/xxxxx.git/info/lfs.locksverify true
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s
Uploading LFS objects: 100% (1/1), 25 MB | 0 B/s
Uploading LFS objects: 100% (1/1), 25 MB | 0 B/s, done
git : To https://xxxxxxx.visualstudio.com/xxxxxxx/_git/xxxxxx
At line:1 char:1
+ git push origin Master_Copy_LFSTest
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (To https://xxxx.../_git/xxxxxx:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
58a347c..738f4a6 Master_Copy_LFSTest -> Master_Copy_LFSTest
哪种方法看起来有效,但显然发生了一些事情,导致了未指定的错误。
所以它“看起来”像是起作用了,但我真的说不出来。
如果我进入vsts中分支的代码文件查看器并单击pdf文件,它会将二进制文件加载到查看器中,这是我所不期望的,我想我会看到三行指针文件。
这是节目的输出
git show 738f4a6
commit 738f4a6bc8a87ce34ab2352bb58a0a44c96be48a
Author: Paul <mememe@mememe.com>
Date: Thu Jul 19 13:53:37 2018 -0400
some comment
diff --git a/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf b/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
new file mode 100644
index 0000000..4179d33
--- /dev/null
+++ b/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c7aed7138ea8a2f6eda3e22992a52329d2b945c119a517c02056bf8379b92f36
+size 24590383
git lfs ls-files
c7aed7138e * 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
但真正让我抓狂的是,如果我做了一个VSTS构建,并且在get sources步骤中没有选中Checkout files from LFS复选框,那么我仍然会在输出中获得pdf文件(其中一个项目文件引用它以始终复制到输出)如果这是真的工作,我会通过我会得到指针文件,而不是真正的pdf。
这是第二次尝试的命令转储
PM> git lfs track "*.pdf"
Tracking "*.pdf"
PM> git lfs ls-files
PM> git lfs ls-files
PM> git add .
PM> git lfs ls-files
e545334f11 * 1.pdf
PM> git commit -m "added file for lfs"
[master_bugs 3840795] added file for lfs
1 file changed, 3 insertions(+)
create mode 100644 1.pdf
PM> git push origin master_bugs
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.https://xxxxxxxxx.visualstudio.com/xxxxxx/_git/xxxxx.git/info/lfs.locksverify true
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s
Uploading LFS objects: 100% (1/1), 2.7 MB | 0 B/s
Uploading LFS objects: 100% (1/1), 2.7 MB | 0 B/s, done
git : To https://xxxxxxxx.visualstudio.com/xxxxxxxx/_git/xxxxx
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (To https://xxxx.../_git/xxxxx:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
7c41bfe..3840795 master_bugs -> master_bugs
PM> git config lfs.https://xxxxxxxx.visualstudio.com/xxxxxxxx/_git/xxxxxxx.git/info/lfs.locksverify true
PM> git push origin master_bugs
git : Everything up-to-date
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Everything up-to-date:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PM> git push origin master_bugs
git : Everything up-to-date
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Everything up-to-date:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PM> git show 3840795
commit 3840795646ae042c7d87c34b32ee7235f776f952
Author: Paul <xxxxx@xxxxxxx.com>
Date: Thu Jul 19 15:58:16 2018 -0400
added file for lfs
diff --git a/1.pdf b/1.pdf
new file mode 100644
index 0000000..5e46737
--- /dev/null
+++ b/1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e545334f117b7a01e03df7b7d1ba744ff752fdbe28bbfc1178d0a43a95db87cd
+size 2701762
PM> git show 7c41bfe
commit 7c41bfe52faeb8dd4dcb822195c679fc9cb3e4d0
Author: Paul <xxxxx@xxxxxxx.com>
Date: Thu Jul 19 15:54:11 2018 -0400
asdsad
diff --git a/.gitattributes b/.gitattributes
index 09d8abc..b634d85 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
-"*.pdf" filter=lfs diff=lfs merge=lfs -text
-'*.pdf' filter=lfs diff=lfs merge=lfs -text
我怎么知道这是否有效?