I'd like to initialize several local git repositories on an external drive (git init --bare reponame) supporting git LFS protocol. I.e. after cloning these, I'd like to be able to track large files via LFS (the version of the files should then be stored on the external drive)
Doing this without any additional steps did not work (i.e. clone empty repo, track large files with git LFS, and try to push to remote):
Git LFS: (0 of 122 files) 0 B / 157.56 MB
http: Post /media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:
unsupported protocol scheme ""
http: Post /media/me/bigdrive/git_repos/coding.git/info/lfs/objects/batch:
unsupported protocol scheme ""
error: failed to push some refs to '/media/me/bigdrive/git_repos/coding'`
I found no guide on how to do this and the LFS man page did not seem to provide a solution. The GitHub/BitBucket guides only explain how to do this on a local repository and then pushing to a correctly configured git repository on their servers
Appreciate any help, thanks!
I had similar issues, but managed to get it working.
Step 1:
Download and start an LFS server (if you haven't already done so), such as https://github.com/git-lfs/lfs-test-server (Don't use this one in production.)
Step 2:
Correctly set up the LFS server URL for your repo, as described here: https://github.com/git-lfs/git-lfs/wiki/Tutorial#lfs-url
In my case, running the following in my working copy folder was enough:
git config -f .lfsconfig lfs.url http://username:password@localhost:8080
git add .lfsconfig
Replace username and password by your desired credentials, and localhost:8080 by your Git server URL.
You can run git lfs env
to verify your results.
Step 3:
Set up your LFS_ADMINUSER
and LFS_ADMINPASS
environment variables as described here: https://github.com/git-lfs/lfs-test-server#running
Then, you should be able to visit http://localhost:8080/mgmt (or wherever your LFS server is running) in your browser and add your credentials.
The results look promising:
C:\Users\Nick\Desktop\WorkingCopy\Repo>git push origin master
warning: current Git remote contains credentials
warning: current Git remote contains credentials
Git LFS: (1 of 1 files) 6.72 KB / 6.72 KB
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 428 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To C:/Users/Nick/Desktop/WorkingCopy/../Repo
309629f..7fe106d master -> master
The lfs-content folder of the LFS server now contains a file with the exact size of the added file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With