git lfs init # initialize the Git LFS project project
git lfs init # initialize the Git LFS project project
git lfs track "*.iso"# select the file extensions that you want to treat as large files
git lfs track "*.iso"# select the file extensions that you want to treat as large files
```
Once a certain file extension is marked for tracking as a LFS object you can use Git as usual without having to redo the command to track a file with the same extension:
```bash
cp ~/tmp/debian.iso ./ # copy a large file into the current directory
cp ~/tmp/debian.iso ./ # copy a large file into the current directory
git add .# add the large file to git annex
git add .# add the large file to the project
git commit -am"Added Debian iso"# commit the file meta data
git commit -am"Added Debian iso"# commit the file meta data
git push origin master # sync the git repo and large file to the GitLab server
git push origin master # sync the git repo and large file to the GitLab server
```
```
...
@@ -80,26 +85,32 @@ git lfs fetch debian.iso # download the large file
...
@@ -80,26 +85,32 @@ git lfs fetch debian.iso # download the large file
```
```
## Troubleshooting tips
## Troubleshooting
### error: Repository or object not found
### error: Repository or object not found
Few reasons why this error can occur:
There are a couple of reasons why this error can occur:
1. Check the version of Git LFS on the client machine, `git lfs version`. Only version 0.6.0 and up are supported.
* Wrong version of LFS client used:
1. Check the Git config for traces of deprecated API, `git lfs -l`. If `batch = false` remove the line and try using Git LFS client > 0.6.0
Check the version of Git LFS on the client machine with `git lfs version`. Only version 0.6.0 and newer are supported.
* Project is using deprecated LFS API
Check the Git config of the project for traces of deprecated API with `git lfs -l`. If `batch = false` is set in the config, remove the line and try using Git LFS client newer than 0.6.0.
### Invalid status for <url> : 501
### Invalid status for <url> : 501
When attempting to push a LFS object to a GitLab server that doesn't have Git LFS support enabled, server will return status `error 501`. Check with your GitLab administrator why Git LFS is not enabled on the server
When attempting to push a LFS object to a GitLab server that doesn't have Git LFS support enabled, server will return status `error 501`. Check with your GitLab administrator why Git LFS is not enabled on the server. See [Configuration section](#configuration) for instructions on how to enable LFS support.
### getsockopt: connection refused
### getsockopt: connection refused
When pushing a LFS object and you receive an error similar to: `Post <URL>/info/lfs/objects/batch: dial tcp IP: getsockopt: connection refused`,
If you push a LFS object to a project and you receive an error similar to: `Post <URL>/info/lfs/objects/batch: dial tcp IP: getsockopt: connection refused`,
LFS client is trying to reach GitLab through HTTPS but your GitLab is being served on HTTP.
the LFS client is trying to reach GitLab through HTTPS. However, your GitLab instance is being served on HTTP.
This behaviour is caused by Git LFS using HTTPS connections by default when it doesn't have a `lfsurl` set in the Git config.
This behaviour is caused by Git LFS using HTTPS connections by default when a `lfsurl` is not set in the Git config.
To go around this issue set the lfs url in git config:
To prevent this from happening, set the lfs url in project Git config: