美文网首页
git 指定目录 拉取文件

git 指定目录 拉取文件

作者: IT513 | 来源:发表于2018-09-21 12:12 被阅读0次

使用该功能 主要是设计也是通过git来管理设计图的
启用了 git LFS 管理
但是其他协助人员只需要拉取 jpg、png 等预览图 就可以,所以需要指定拉取目录

1、在项目目录下git 初始化

git init 
image.png

2、修改.git文件夹里面的 config 文件 .git/config 启用 sparse checkout(稀疏检出)

  • 方法 直接修改文件 或者用 git bash 命令的方式修改
#文件config 的初始化内容
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true

#修改 config 后的内容  url 修改为需要拉取的仓库地址
[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    sparsecheckout=true
[remote "origin"]
    url = http://git.xxxxx.com/xxxx/xxxx.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

3、在 .git/info 创建 sparse-checkout 文件,在文件里面指定需要拉取的目录或内容

image.png

4、开始拉取 git pull (需要输入账号密码)

相关文章

网友评论

      本文标题:git 指定目录 拉取文件

      本文链接:https://www.haomeiwen.com/subject/gebwnftx.html