Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure DevOps&使用Git LFS锁定文件:推送期间是否验证了锁定?_Git_Azure Devops_Git Lfs - Fatal编程技术网

Azure DevOps&使用Git LFS锁定文件:推送期间是否验证了锁定?

Azure DevOps&使用Git LFS锁定文件:推送期间是否验证了锁定?,git,azure-devops,git-lfs,Git,Azure Devops,Git Lfs,我是Git LFS锁定功能的新手,对它如何与Azure DevOps协同工作有疑问。它是否只是向本地分支添加只读标志?或者服务器上是否有一些魔法可以防止更改远程分支上锁定的文件 例如,我可以在本地更改锁定的文件,并将这些更改推送到远程分支,而无需Azure DevOps阻止推送。我希望有什么东西来验证锁定的文件没有被推送到远程分支。样本: # Verify lock C:\repo> git lfs lock .\test.png Lock failed: There is an ex

我是Git LFS锁定功能的新手,对它如何与Azure DevOps协同工作有疑问。它是否只是向本地分支添加只读标志?或者服务器上是否有一些魔法可以防止更改远程分支上锁定的文件

例如,我可以在本地更改锁定的文件,并将这些更改推送到远程分支,而无需Azure DevOps阻止推送。我希望有什么东西来验证锁定的文件没有被推送到远程分支。样本:

# Verify lock 

C:\repo> git lfs lock .\test.png
Lock failed: There is an existing lock on this path.

# Simulate an app that changes the read-only flag, and makes changes to .\test.png

C:\repo> attrib -r .\test.png

# I opened .\test.png in MSPaint and made changes to it.

# Stage and commit changed file

C:\repo> git add .
C:\repo> git commit -m "testing changing locked file"
[master 57031ee] testing changing locked file
 1 file changed, 2 insertions(+), 2 deletions(-)

# Push commit. I'd expect this fail, since file is locked by another user, but it doesn't fail.

C:\repo> git push
Consider unlocking your own locked files: (`git lfs unlock <path>`)
* test.png
Uploading LFS objects: 100% (1/1), 11 KB | 0 B/s, done.
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 16 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 374 bytes | 374.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Analyzing objects... (3/3) (267 ms)
remote: Checking for credentials and other secrets... (1/1) done (4 ms)
remote: Checking path lengths for refs and files...  done (5 ms)
remote: Storing packfile... done (161 ms)
remote: Storing index... done (102 ms)
To https://<myteam.visualstudio.com/DefaultCollection/<myproject>/_git/<myrepo>
   5b2a9d6..57031ee  master -> master
推送提交。我认为这会失败,因为文件被另一个用户锁定,但它不会失败。 使用相同的命令执行与您相同的行为,但根据:Git LFS将验证您在推送时没有修改被其他用户锁定的文件

如果希望push命令失败,请尝试相应的git lfs命令git lfs push origin master-all,而不是普通的git push命令git push origin master

如果使用git lfs push命令,结果如下:


嗨,朋友,这个问题有更新吗?你解决这个问题了吗?请检查我下面的回答是否有助于解决您的问题。如果是,您可以,如果不是,请告诉我有关此问题的最新信息?