Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to direct git-lfs traffic for multiple remotes to a single endpoint?

I use a workstation to develop and two remotes to store: a local (LAN) git server [origin] and a hosted (e.g. bitbucket/github) git server [cloud] for extra backup.

I am currently using git lfs to track png files and my available online storage is running out. As a solution, I'd like to store png files exclusively on the origin remote. To achieve this I have attempted to configure the lfsurl for my cloud endpoint to be the same as the origin. This way, I expect that pushing a png to either git endpoint would result in the image going to the same location (and ignored in the cloud push?).

For a given repo here are samples of my git config files:

.git/config

[remote "origin"]
url = ssh://[email protected]:7999/project/repo-data.git
[remote "cloud"]
url = [email protected]:user/repo-data.git

.lfsconfig

[remote "cloud"]
lfsurl = https://git.myserver.com/project/repo-data.git/info/lfs

Output from git lfs env

$ git lfs env
Endpoint=https://git.myserver.com/project/repo-data.git/info/lfs (auth=none)
Endpoint (cloud)=https://git.myserver.com/project/repo-data.git/info/lfs (auth=none)

The above configuration is functional as images are pushed to git lfs. Unfortunately the images continue to be pushed to both remotes (origin + cloud). I expect the pointer file on the cloud remote, but no png.

I suspect my lfsurl is incorrect and git lfs is falling back to the default url for each remote, but I see no errors or warnings. Are there tools/logs to troubleshoot?

How to direct git lfs traffic for multiple remotes to a single endpoint?

Thanks.

like image 227
user2704504 Avatar asked Jul 30 '16 14:07

user2704504


1 Answers

Today I got the same situation, I worked it out with the following configuration.

.lfsconfig

[lfs]
        url = https://git.labs.xxxxx/test/test.git/info/lfs

You can refer to the tutorial

you should disable LFS functionality in GitLab if you use GitLab and LFS objects are not stored in the GitLab built-in LFS server, otherwise you will fail to push, refer to the POST.

like image 110
Jinlxz Liu Avatar answered Oct 20 '22 21:10

Jinlxz Liu