Git – Special Files – .gitattributes

Background

Unfortunately ran into an error trying to upload a big file unto Git.

Git

Git LFS

I thought I had that problem behind me.

Years prior I had set up Git LFS.

By the way,  LFS translates to “Large File Support”.

StackOverfow

Googled for help.

Thankfully landed at StackOverfow.

The StackOverfow Q/A Post is availed here:-

Git lfs – “this exceeds GitHub’s file size limit of 100.00 MB”
Link

As I tried some of the options, the most rewarding advice was to use the git lfs migrate option.

Outline

  1. git lfs
    • git lfs migrate import
    • git lfs track
  2. Mark Special Git Files
    • git add .gitattributes

 

git lfs

git lfs migrate option

Syntax

git lfs migrate import --include="<file-name>" 

Sample

git lfs migrate import --include="*.bak" 

git lfs track

Syntax

git lfs track <file-name> 

Sample

git lfs track *.bak 

Mark Git Files

git add .gitattributes

Syntax

git add <file-name> 

Sample

git add .gitattributes

Git – File – .gitattributes

Review File

Using “type .gitattribute” the command, was able to review the content of the .gitattribute file.

Content – Initial

Image

Textual

>type .gitattributes
.bak filter=lfs diff=lfs merge=lfs -text
*.bak filter=lfs diff=lfs merge=lfs -text

Explanation

I noticed that the first entry is a typo.

It reads .bak and not *.bak; which is our actual file mask.

Git lfs untrack

Outline

Let us use git lfs untrack to unflag the mislabeled file.

Command
Syntax

git lfs untrack <filemask>

Sample

git lfs untrack ".bak"

Output
Textual

untracking ".bak"

Image

Content – Post

Image

Textual

>type .gitattributes
*.bak filter=lfs diff=lfs merge=lfs -text

Explanation

Thankfully, we now only have the single ( *.bak ) entry.

Summary

The depth and breath of git is truly remarkable.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s