Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git init will not create git directories for me

Tags:

git

git-init

I am new to Git. I can get a Git directory structure in a bare directory with git -init --bare. I can see where the git information is stored.

However, when I try to use git init or even git clone, I never see any .git subdirectory in my local repository. I can add files and push, but have no idea where those files are actually stored on disk for my local repository.

From the documentation:

$ git init

This creates a new subdirectory named .git that contains all of your necessary repository files – a Git repository skeleton.

However, I never see that skeleton directory. I have used dir -AH to see if the git directory is hidden, but there is none. Why do I not get a git skeleton directory? And where, exactly are the added (staged) files put?

like image 975
jmknpk Avatar asked Mar 07 '15 11:03

jmknpk


2 Answers

On Windows, git init may create a hidden .git folder. Go to Organize --> Files and Search Options --> and then check Show Hidden Files. That will unveil the .git folder.

like image 139
multigoodverse Avatar answered Oct 12 '22 11:10

multigoodverse


Except if you have used the --git-dir option when running "git init", your .git directory MUST be in the directory. Perhaps you should look more carefully.

In the same idea, perhaps have you set an environment variable GIT_DIR that change the place where the .git directory is stored. See http://git-scm.com/docs/git-init Remove this env variable if it's the case.

And the added (staged) files are stored in the index file stored inside this .git directory...

dir -AH (in powershell? otherwise it's dir /AH) works well for me...

like image 41
Philippe Avatar answered Oct 12 '22 09:10

Philippe