edit git lfs
This commit is contained in:
parent
415985d08c
commit
6ccba626c8
@ -1,24 +1,72 @@
|
|||||||
---
|
---
|
||||||
title: "git-lfs"
|
title: "git-lfs"
|
||||||
tags: [ "data" ]
|
tags: [ "data", "git" ]
|
||||||
---
|
---
|
||||||
|
|
||||||
Install, and add with
|
Git Large File Storage ('LFS') needs to change your `~/.gitconfig` to check out those binary files:
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
|
cat ~/.gitconfig
|
||||||
git lfs install
|
git lfs install
|
||||||
|
cat ~/.gitconfig
|
||||||
```
|
```
|
||||||
|
|
||||||
Then track some filetype with:
|
Then track some filetypes with:
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
git lfs track "\*.ttf"
|
cd $git_repository
|
||||||
|
ext=ttf
|
||||||
|
git lfs track "*.$ext"
|
||||||
```
|
```
|
||||||
|
|
||||||
Or a directory with:
|
Or a directory with:
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
git lfs track "images/"
|
git lfs track "images/"
|
||||||
```
|
```
|
||||||
|
|
||||||
All changes require adding `.gitattributes`.
|
Track the changes to `.gitattributes`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git status
|
||||||
|
git add .gitattributes
|
||||||
|
git commit -m "add $ext to lfs"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Bash Completion
|
||||||
|
|
||||||
|
If bash completion does not work, you'll have to add it:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git lfs completion bash | sudo tee /usr/share/bash-completion/completions/git-lfs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Trouble Shooting
|
||||||
|
|
||||||
|
You have some file "$FILE".png, which has some problem.
|
||||||
|
|
||||||
|
Check the filetype:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
file "$FILE".png
|
||||||
|
```
|
||||||
|
|
||||||
|
This should say the type is 'image'.
|
||||||
|
If it says the type is 'text', then this file is really just a reminder to `git-lfs` to check out that file.
|
||||||
|
|
||||||
|
Check `git-lfs` is expecting that file:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git lfs status
|
||||||
|
git lfs ls-files
|
||||||
|
```
|
||||||
|
|
||||||
|
...then try these commands, and check the filetype again:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git lfs fetch --all
|
||||||
|
git lfs fsck
|
||||||
|
git lfs checkout
|
||||||
|
git lfs status
|
||||||
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user