New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to share large content between repo directories. #766
Comments
I'd be into allowing the https://github.com/github/git-lfs/blob/f56cd54ad7f8e13df6415a568f5681394bd44b31/lfs/lfs.go#L99-L119 This would lead to a shared LFS directory on each CI server. I also wanted to experiment with some kind of LFS proxy, which could let you have your own shared storage for ALL your CI servers. This could greatly reduce the bandwidth with your upstream LFS server if it isn't already hosted inside your network. |
Shared folders and the environment variable could get you close to a single storage location solution. |
What about driving lfs.LocalMediaDir via the git-config - it would match the ways we configure the endpoint in git-lfs. git config --add lfs.localMediaDir ? |
I like the |
I have workflows that would also be helped by this option, so 👍 . |
Have you tried using |
That's a good suggestion, but my applications is slightly different. I want a local cache of all my objects across all my projects. We have large binaries that are shared across multiple projects and get added and removed fairly frequently. Ideally there would be a global LRU cache of objects. The folder for this cache could be configured per project. |
Sounds like there are two use cases here:
Anyone want to take this on? |
Git worktree looks like a potential solution, I'm using Jenkins and will have to dig into whether I can use this easily in my case. If not, I'm definitely willing to start looking at a Git-lfs solution. Caveats: I'm new to Go and new to Git. If someone else wants to pick this up before that, just let me know here. I'll get back to this thread next week after digging into the worktree solution and let you know. |
You mean unrelated repos? If they were required to register with the shared directory somehow (just a dir with files that are pointers back to the repo) then prune could follow that and behave like it does for worktree, including those other repos in the retain set. Would need an equivalent of In |
Worktrees are working for me so I'm not compelled to add this functionality right now. @sinbad for the win. |
What if the shared object directory could be provided as an alternative? Similar to git clone reference repository. I.e. the objects would be searched from:
It would be very flexible setup for object sharing yet it should not cause any problems with prune command. |
Added to the roadmap in #1438. |
For now, how can we change |
Old question, but I'm also confused about configuration in shared directory (for build controllers). I was able to find solution only after research in source code in IDE. if c.fs == nil {
lfsdir, _ := c.Git.Get("lfs.storage")
c.fs = fs.New(c.LocalGitDir(), c.LocalWorkingDir(), lfsdir)
} // New initializes a new *Filesystem with the given directories. gitdir is the
// path to the bare repo, workdir is the path to the repository working
// directory, and lfsdir is the optional path to the `.git/lfs` directory.
func New(gitdir, workdir, lfsdir string) *Filesystem {
fs := &Filesystem{
GitStorageDir: resolveGitStorageDir(gitdir),
}
fs.ReferenceDir = resolveReferenceDir(fs.GitStorageDir)
if len(lfsdir) == 0 {
lfsdir = "lfs"
}
if filepath.IsAbs(lfsdir) {
fs.LFSStorageDir = lfsdir
} else {
fs.LFSStorageDir = filepath.Join(fs.GitStorageDir, lfsdir)
}
return fs
} Docs git-lfs-config.5.ronn >git config --global lfs.storage C:\lfs\storage
>git config lfs.storage
C:\lfs\storage
>git clone https://my-vsts-account.visualstudio.com/_git/lfs-test
Cloning into 'lfs-test'...
Unpacking objects: 100% (14/14), done.
Filtering content: 100% (5/5), 6.80 MiB | 801.00 KiB/s, done.
>ls C:\lfs\storage
incomplete objects tmp
>ls C:\lfs\storage\objects
18 1c 51 a7 ca
>cd lfs-test
>ls -a .git
. .. HEAD config description hooks index info logs objects packed-refs refs Per project directory in bash (mingw) $ git -c lfs.storage=/C/lfs/storage/lfs-test clone https://my-vsts-account.visualstudio.com/_git/lfs-test && cd lfs-test && git config lfs.storage /C/lfs/storage/lfs-test |
Hi @dtulepov, these are all great references. I'm not quite sure about your specific question: are you having trouble configuring |
My objective in our CI is to be able to sync multiple branches one to one with folders, but right now that means a new download of our large content - roughly 15 GB - for every new branch. Seems like I should be able to move the storage for the local media and it's metadata out to a shared folder which git-lfs could leverage. As far as I can tell there is no way to adjust the local media directory that reports from "git lfs env". If so then this might just be a documentation clarity issue. I'm not certain if there are implementation details preventing this either.
The text was updated successfully, but these errors were encountered: