安装了Git但没有.git目录,因此我无法对其进行配置

时间:2019-05-20 06:54:26

标签: git ubuntu root

.git文件夹不存在

上个月相同的配置具有.git目录

ls -la
total 97
drwxr-xr-x  24 root root  4096 Apr 19 09:22 .
drwxr-xr-x  24 root root  4096 Apr 19 09:22 ..
drwxr-xr-x   2 root root  4096 Apr 16 05:01 bin
drwxr-xr-x   4 root root  1024 Apr 16 05:03 boot
drwxr-xr-x  19 root root  3980 May 15 03:42 dev
drwxr-xr-x  92 root root  4096 May 17 02:58 etc
drwxr-xr-x   3 root root  4096 Apr 16 05:03 home
lrwxrwxrwx   1 root root    32 Apr 16 04:57 initrd.img -> boot/initrd.img-4.4.0-87-generic
drwxr-xr-x  22 root root  4096 Apr 16 05:01 lib
drwxr-xr-x   2 root root  4096 Apr 16 04:57 lib64
drwx------   2 root root 16384 Apr 16 04:57 lost+found
drwxr-xr-x   4 root root  4096 Apr 16 04:57 media
drwxr-xr-x   2 root root  4096 Aug  1  2017 mnt
drwxr-xr-x   2 root root  4096 Aug  1  2017 opt
dr-xr-xr-x 186 root root     0 May 15 03:42 proc
drwxr-xr-x   3 root root  4096 Apr 19 09:22 pub
drwx------   3 root root  4096 May 17 04:39 root
drwxr-xr-x  25 root root   920 May 17 02:58 run
drwxr-xr-x   2 root root 12288 Apr 16 05:03 sbin
drwxr-xr-x   2 root root  4096 Apr 29  2017 snap
drwxr-xr-x   2 root root  4096 Aug  1  2017 srv
dr-xr-xr-x  13 root root     0 May 17 02:59 sys
drwxrwxrwt   9 root root  4096 May 17 05:39 tmp
drwxr-xr-x  10 root root  4096 Apr 16 04:57 usr
drwxr-xr-x  14 root root  4096 Apr 16 05:02 var
lrwxrwxrwx   1 root root    29 Apr 16 04:57 vmlinuz -> boot/vmlinuz-4.4.0-87-generic

无法创建文件夹

1 个答案:

答案 0 :(得分:1)

如果您正在谈论.gitconfig文件,那么它应该位于您的主目录下。此文件包含用户特定的配置。

运行.git时,会在存储库中创建git init文件夹。它包含项目的版本控制所需的所有信息。它还包含有关提交,远程存储库,地址等的信息。

请参见docs

  

此命令创建一个空的Git存储库-基本上是一个.git目录,其中包含objectsrefs/headsrefs/tags和模板文件的子目录。还将创建引用master分支的HEAD的初始HEAD文件。