4

I have a giant directory which I need to import into git, and I am suffering the hell of line ending management.

Initially I need to just put everything inside the repo, having no time to deal with line endings. To get that, I added a .gitattributes file with * -text, but that doesn't solve the problem because there are lots of subdirectories containing modules with their own .gitattributes files and text=auto.

Is there any way to get all the files inside the repo with no more struggle?

4
  • Do you mean .gitattributes? That's where things like * -text go ... not in .gitignore. Commented Sep 29, 2015 at 14:23
  • Sorry, mistake. Edited. Commented Sep 29, 2015 at 14:25
  • I just tested, git has no problem commiting files having unix or dos line endings into the same repository. Could you elaborate your problem further? What message do you get from git? Commented Sep 29, 2015 at 14:27
  • The problem appears with git add, which rejects files not according the current eol configuration (in tis case, dictated by gitattributes) Commented Sep 29, 2015 at 14:28

1 Answer 1

2

The gitattributes documentation states:

When deciding what attributes are assigned to a path, Git consults:

  • $GIT_DIR/info/attributes file (which has the highest precedence),
  • .gitattributes file in the same directory as the path in question, and its parent directories up to the toplevel of the work tree (the further the directory that contains .gitattributes is from the path in question, the lower its precedence).
  • Finally global and system-wide files are considered (they have the lowest precedence).

If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user’s workflow for that repository), then attributes should be placed in the $GIT_DIR/info/attributes file.

So try and set your * -text directive in $GIT_DIR/info/attributes, at least for your initial add and commit.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.