artemkin / git-lfs-server

Git LFS server
Other
140 stars 20 forks source link

Simple example #7

Closed joshlk closed 6 years ago

joshlk commented 6 years ago

Hey,

I would like to set-up a git-lfs-server but keep GitHub as the normal git remote. I'm trying to create a simple example but running into some difficulty. I would be very grateful if you can help me.

On the server side (Ubuntu, $IP is the IP of the server):

# Unpack and run lfs_server
wget https://github.com/artemkin/git-lfs-server/releases/download/v0.3.0/lfs_server-0.3.0-linux.x64.tar.gz
tar xfs lfs_server-0.3.0-linux.x64.tar.gz
cd lfs_server
mkdir data
./lfs_server.sh -s $IP -p 5000 data

On my local computer (Mac):

# Clone a new repo
git clone git@github.com:joshlk/lfs_test.git
cd lfs_test

# Install LFS, track a file and commit
git lfs install
mkfile -n 10m test.bin
git lfs track test.bin
git add .gitattributes test.bin
git commit -m "LFS file"

# Configure LFS remote
git config -f .lfsconfig lfs.url http://$IP:5000/joshlk/lfs_test.git
git add .lfsconfig

# Try to push the newly added LFS file
git push

I then get the error on my local computer:

Git LFS: (0 of 1 files) 0 B / 10.00 MB
batch response: Wrong path
error: failed to push some refs to 'git@github.com:joshlk/lfs_test.git'

And if I look at the server output:

2018-01-18 11:32:54.947849Z Listening for HTTP on $IP:5000
2018-01-18 11:40:20.303692Z Error 192.168.10.102 "POST /joshlk/lfs_test.git/locks/verify HTTP/1.1" 404 Not Found "Wrong path"

Do I need to add additional folders or do any additional commands?

The git lfs client I installed using brew and the version is: git-lfs/2.3.4 (GitHub; darwin amd64; go 1.9.1)

silvio commented 6 years ago

Hi @artemkin , I have the same problem. I know #2 is fixed, but it seems somthing still goes wrong. I'm using the latest version from your repo. And this is my environment ...

sfr@develbox /development/projects/testrepo % git lfs env
git-lfs/2.3.4 (GitHub; linux amd64; go 1.9.1; git d2f6752f)
git version 2.16.0

Endpoint=http://server:8080/testrepo (auth=none)
LocalWorkingDir=/development/projects/testrepo
LocalGitDir=/development/projects/testrepo/.git
LocalGitStorageDir=/development/projects/testrepo/.git
LocalMediaDir=/development/projects/testrepo/.git/lfs/objects
LocalReferenceDir=
TempDir=/development/projects/testrepo/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/development/projects/testrepo/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

On serverside I get this messages:

# ./lfs_server.sh -p 8080 -s 0.0.0.0 -verbose /srv/lfs
2018-01-22 08:02:06.101560+01:00 Listening for HTTP on 0.0.0.0:8080
2018-01-22 08:02:09.784718+01:00 Error 192.168.202.112 "POST /testrepo/objects/batch HTTP/1.1" 404 Not Found "Wrong path"
2018-01-22 08:09:44.660604+01:00 Error 192.168.202.112 "POST /testrepo/objects/batch HTTP/1.1" 404 Not Found "Wrong path"
silvio commented 6 years ago

Ahhh, I have understand my problem. @joshlk you have used git config -f .lfsconfig lfs.url http://$IP:5000/joshlk/lfs_test.git as your endpoint address. But you must use the server address only like git config -f .lfsconfig lfs.url http://$IP:5000/.

No problem on my side anymore.

artemkin commented 6 years ago

@joshlk sorry for the silence (quite busy last month), is it still an issue for you?

joshlk commented 6 years ago

Yep, it working for now. Great!

@artemkin I would be happy to write this up as an example if you would like to put on the front page to help others?

artemkin commented 6 years ago

@joshlk sure, it would be great!

arkdae commented 6 years ago

Is it not possible to provide a directory in the URL so that the lfs_server can store large files from separate repositories in different locations?

For example, this works for me: http://localhost:8080

But I would like to be able to use: http://localhost:8080/my/repo1 http://localhost:8080/my/repo2

I tried creating my/repo1 for example under the .lfs directory from where I started lfs_server.sh, and also outside that directory but I get the same error as posted above: Not found "Wrong path."

I'm using this with gitolite, and I can customize the git-lfs-authenticate script to provide the proper URL depending on which repo is being worked on.

artemkin commented 6 years ago

No, lfs_server is very simple, and doesn't support multiple folders.