git init不会为我创建git目录 [英] git init will not create git directories for me

查看:242
本文介绍了git init不会为我创建git目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Git的新手。
我可以使用 git -init --bare 在裸目录中获得Git目录结构。
我可以看到git信息的存储位置。



然而,当我尝试使用 git init 甚至是 git clone ,我从未在我的本地存储库中看到任何 .git 子目录。我可以添加文件和推送,但不知道这些文件实际存储在本地存储库的磁盘中的位置。



从文档:


  $ git init 

这将创建一个名为 .git 的新子目录,其中包含所有必要的存储库文件 - 一个Git存储库骨架。


但是,我从来没有看到骨架目录。我用 dir -AH 来查看git目录是否隐藏,但是没有。为什么我没有得到一个git骨架目录?那么,究竟是添加(staged)的文件吗?

解决方案

除非您使用当运行git init时,你的 .git 目录 MUST 必须位于目录中--git-dir 选项。也许你应该仔细看看。



在同样的想法中,也许你已经设置了一个环境变量 GIT_DIR 存放 .git 目录的地方。请参阅 http://git-scm.com/docs/git-init 删除此内容如果是这种情况,env变量。

添加的(分阶段)文件存储在文件中的索引 .git 目录...



dir -AH (在powershell中,否则它是 dir / AH )适合我...


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?

解决方案

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...

这篇关于git init不会为我创建git目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆