WFW
WFW

Reputation: 135

git init is creating in incomplete .git folder - how do I fix it?

When I used to run git init, I'd get a .git folder that looked like this:

.git
|_config
|_description
|_HEAD
|_hooks/
|_index
|_info/
|_logs/
|_objects/
|_refs/

now, git init is producing this:

.git
|_HEAD
|_config
|_hooks/
|_index
|_logs/
|_objects/
|_refs/

Why isn't it creating info/ anymore - am I missing something obvious or is something really going wrong? Is there an easy way to fix my git setup so that git init works properly/like it used to?

edit: git version 1.7.12.4 (Apple Git-37) -- I think it's the standard that comes installed on a macbook with mountain lion. No updates were performed in the meantime, the only thing I can think of is eclipse (Juno) picked up a git folder for a project - it could conceivably have modified some settings, but my gitconfig and git_templates look the same.

Upvotes: 1

Views: 354

Answers (3)

WFW
WFW

Reputation: 135

Turns out the issue/solution was really simple:

I was expecting my git init to pull from both template folders (my /usr/share/git-core/templates and the one at ~/.git_templates referenced in $GIT_TEMPLATE_DIR that I set up for myself to add my own hooks). It seems like it will only use one, so I just cp'd over the core stuff to my new one and everything works great.

Upvotes: 1

sleske
sleske

Reputation: 83599

In my git installation (Debian package, version 1.8.1.1), git init will create the directory .git/info, but only if it is included in /usr/share/git-core/templates/. This is the templating mechanism described in the manpage of git init (section "TEMPLATE DIRECTORY").

So check whether the info directory is included in your template directory (which may be in multiple places, check the manpage).

As to why it is no longer automatically created: That seems to be caused by your git installation or by your personal config. Git from the official git repository will create this directory.

Upvotes: 1

jthill
jthill

Reputation: 60305

The minimal valid git repo is

mkdir -p .git/{objects,refs}
echo ref: refs/heads/master > .git/HEAD
git config core.repositoryformatversion 0

Anything past that that you want to be sure of, just add e.g. mkdir -p .git/info to your own ritual.

Upvotes: 2

Related Questions