LoginSignup
0
1

More than 3 years have passed since last update.

Macで、git lfsをお試し利用

Posted at

環境

Mac
$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.13.6
BuildVersion:   17G4015

git lfs をお試し利用

以下を参考にさせて頂きました。

macOS で Git LFS (Large File Storage) を使ってみる

$ brew install git-lfs
$ git lfs version # バージョン確認
   git-lfs/2.11.0 (GitHub; darwin amd64; go 1.14.2)
$ git lfs install # 初期設定
   Git LFS initialized.
$ grep -A 4 lfs ~/.gitconfig # 初期設定により ~/.gitconfig にgit lfs用の設定が行われる事を確認
   [filter "lfs"]
    process = git-lfs filter-process
    required = true
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
$ git clone (GitサーバのリポジトリのURL)
$ git cd (リポジトリ名)
$ dd if=/dev/zero of=blankfile bs=1m count=101  # 101MBのファイル追加
$ git lfs track blankfile                       # git lfsに追加
   Tracking "blankfile"
$ cat .gitattributes                            # git lfsに追加できている事を確認
   blankfile filter=lfs diff=lfs merge=lfs -text
$ git add .gitattributes blankfile              # ステージに追加する
$ git status                                    # ステージに追加されている事を確認
   On branch master
   Your branch is up to date with 'origin/master'.

   Changes to be committed:
     (use "git restore --staged <file>..." to unstage)
    new file:   .gitattributes
    new file:   blankfile
$ git commit -m "Add blankfile"                 # commit (ここは通常のgitと同じ)
$ git push origin master                        # push (ここは通常のgitと同じ)

確認後、blankfileはお試し用なので削除しておく

$ git rm blankfile
$ git commit -m "Delete blankfile"
$ git push origin master        

ヨシ

参考

macOS で Git LFS (Large File Storage) を使ってみる
Git LFS Specification
Git LFS をちょっと詳しく
git-lfsの仕様(サーバ側)を個人的に解説してみる

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1