Skip to content

Instantly share code, notes, and snippets.

@joeskeen
Created July 12, 2019 15:11
Show Gist options
  • Save joeskeen/f27c22e5ec179c8773237049ac1a6aac to your computer and use it in GitHub Desktop.
Save joeskeen/f27c22e5ec179c8773237049ac1a6aac to your computer and use it in GitHub Desktop.
Trying to get Git LFS to work with Azure Repos
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ git clone git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction
Cloning into 'With%20File%20Size%20Restriction'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ git clone git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/Without%20File%20Size%20Restriction
Cloning into 'Without%20File%20Size%20Restriction'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ cp /mnt/c/Windows/media/onestop.mid ./With
With%20File%20Size%20Restriction/ Without%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ cp /mnt/c/Windows/media/onestop.mid ./With
With%20File%20Size%20Restriction/ Without%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ cp /mnt/c/Windows/media/onestop.mid ./With%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ cp /mnt/c/Windows/media/onestop.mid ./Without%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ git status ./Without%20File%20Size%20Restriction/
fatal: Not a git repository (or any parent up to mount point /mnt/c)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro
$ cd Without%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
onestop.mid
nothing added to commit but untracked files present (use "git add" to track)
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git add .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git commit -m "Add small file"
[master (root-commit) f10d3a7] Add small file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 onestop.mid
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 24.16 KiB | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Analyzing objects... (3/3) (329 ms)
remote: Storing packfile... done (262 ms)
remote: Storing index... done (90 ms)
To git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/Without%20File%20Size%20Restriction
* [new branch] master -> master
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ cd ../With%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
onestop.mid
nothing added to commit but untracked files present (use "git add" to track)
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git commit -m "Add small file"
[master (root-commit) ef9f23b] Add small file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 onestop.mid
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 24.16 KiB | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Analyzing objects... (3/3) (332 ms)
remote: Storing packfile... done (127 ms)
remote: Storing index... done (78 ms)
To git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction
* [new branch] master -> master
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cp /mnt/c/Windows/media/Ring
Ring01.wav Ring03.wav Ring05.wav Ring07.wav Ring09.wav
Ring02.wav Ring04.wav Ring06.wav Ring08.wav Ring10.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cp /mnt/c/Windows/media/Ring
Ring01.wav Ring03.wav Ring05.wav Ring07.wav Ring09.wav
Ring02.wav Ring04.wav Ring06.wav Ring08.wav Ring10.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cp /mnt/c/Windows/media/Ring05.wav .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cd ../Without%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ cp /mnt/c/Windows/media/Ring05.wav .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git add .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ 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: Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git commit -m "Add large file"
[master 8f08453] Add large file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 814.20 KiB | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Storing packfile... done (86 ms)
remote: Storing index... done (51 ms)
To git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/Without%20File%20Size%20Restriction
f10d3a7..8f08453 master -> master
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/Without%20File%20Size%20Restriction
$ cd ../With%20File%20Size%20Restriction/
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
Ring05.wav
nothing added to commit but untracked files present (use "git add" to track)
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git commit -m "Add large file"
[master 47f43f7] Add large file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 814.20 KiB | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
error: unpack failed: error The blob object 30c65cb98ddff1a80540e0657f87c2a593347e9e was rejected: VS403658: The object is 1132740 bytes, which is greater than the 1048576 byte limit for objects in this repository.
remote: The blob object 30c65cb98ddff1a80540e0657f87c2a593347e9e was rejected: VS403658: The object is 1132740 bytes, which is greater than the 1048576 byte limit for objects in this repository.
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git reset --soft HEAD~;
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git lfs install
Updated git hooks.
Git LFS initialized.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git lfs track Ring05.wav
Tracking "Ring05.wav"
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add .gitattributes
warning: CRLF will be replaced by LF in .gitattributes.
The file will have its original line endings in your working directory.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring05.wav
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add .
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git commit -m "Add large file (using Git LFS)"
[master cff6955] Add large file (using Git LFS)
warning: CRLF will be replaced by LF in .gitattributes.
The file will have its original line endings in your working directory.
2 files changed, 4 insertions(+)
create mode 100644 .gitattributes
create mode 100644 Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master
Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config lfs.https://ssh.dev.azure.com/v3/joeskeen/Test Project/With File Size Restriction.git/info/lfs.locksverify false
batch request: unexpected end of JSON inputB/s
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction'
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master --force
Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config lfs.https://ssh.dev.azure.com/v3/joeskeen/Test Project/With File Size Restriction.git/info/lfs.locksverify false
batch request: unexpected end of JSON inputB/s
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction'
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git reset --soft HEAD~;
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git reset
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitattributes
Ring05.wav
nothing added to commit but untracked files present (use "git add" to track)
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cp /mnt/c/Windows/media/Ring04.wav ./
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ ls -a
. .. .git .gitattributes onestop.mid Ring04.wav Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ ls -l
total 1832
-rwxrwxrwx 1 joeskeen joeskeen 40075 Jul 12 08:45 onestop.mid
-rwxrwxrwx 1 joeskeen joeskeen 698740 Jul 12 08:55 Ring04.wav
-rwxrwxrwx 1 joeskeen joeskeen 1132740 Jul 12 08:51 Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git lfs track Ring04.wav
Tracking "Ring04.wav"
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitattributes
Ring04.wav
Ring05.wav
nothing added to commit but untracked files present (use "git add" to track)
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add Ring04.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cat .gitattributes
Ring05.wav filter=lfs diff=lfs merge=lfs -text
Ring04.wav filter=lfs diff=lfs merge=lfs -text
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add --patch .gitattributes
No changes.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring04.wav
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitattributes
Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ nano .gitattributes
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ cat .gitattributes
# Ring05.wav filter=lfs diff=lfs merge=lfs -text
Ring04.wav filter=lfs diff=lfs merge=lfs -text
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git add .gitattributes
warning: CRLF will be replaced by LF in .gitattributes.
The file will have its original line endings in your working directory.
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ 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: Ring04.wav
Untracked files:
(use "git add <file>..." to include in what will be committed)
Ring05.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git commit -m "Add a small file tracked by Git LFS"
[master a4d2eed] Add a small file tracked by Git LFS
warning: CRLF will be replaced by LF in .gitattributes.
The file will have its original line endings in your working directory.
2 files changed, 5 insertions(+)
create mode 100644 .gitattributes
create mode 100644 Ring04.wav
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master
Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config lfs.https://ssh.dev.azure.com/v3/joeskeen/Test Project/With File Size Restriction.git/info/lfs.locksverify false
batch request: unexpected end of JSON inputB/s
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction'
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$ git push origin master --force
Remote "origin" does not support the LFS locking API. Consider disabling it with:
$ git config lfs.https://ssh.dev.azure.com/v3/joeskeen/Test Project/With File Size Restriction.git/info/lfs.locksverify false
batch request: unexpected end of JSON inputB/s
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/joeskeen/Test%20Project/With%20File%20Size%20Restriction'
joeskeen@DESKTOP /mnt/c/code/sandbox/bug-repro/With%20File%20Size%20Restriction
$
@joeskeen
Copy link
Author

These are the steps I took in summary:

  • Created two Azure Repos Git repositories: With%20File%20Size%20Restriction and Without%20File%20Size%20Restriction
  • In With%20File%20Size%20Restriction, I set the file size limit to 1MB
  • Cloned both repositories locally
  • Added a small file to each and committed/pushed
  • Added a large file to each and committed/pushed - in With%20File%20Size%20Restriction the push is rejected by Azure Repos since the file is larger than the maximum allowable size
  • In With%20File%20Size%20Restriction, undo the last commit
  • Track the large file using Git LFS
  • Re-commit and push - push fails
  • Tried again with a smaller file using Git LFS - same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment