git 本地存储库位于何处?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8855880/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:44:38  来源:igfitidea点击:

Where is the local repository located?

git

提问by WinWin

From Wikipedia:

来自维基百科

enter image description here

在此处输入图片说明

Where is said "Local repository" located physically(in the file system)?

哪里说“本地存储库”位于物理上(在文件系统中)?

回答by Greg Hewgill

The Working Directory is wherever your files are on your local machine. The Local Repository is the .git/subdirectory inside the Working Directory. The Index is a conceptual place that also physically resides in the .git/subdirectory.

工作目录是您的文件在本地计算机上的任何位置。本地存储库是.git/工作目录中的子目录。索引是一个概念上的位置,它实际上也驻留在.git/子目录中。

回答by wikp

Working directory is your code directory

工作目录是你的代码目录

Local repository is .git folder in Working directory

本地存储库是工作目录中的 .git 文件夹

Remote repository is bare repository on server or in the filesystem

远程存储库是服务器上或文件系统中的裸存储库

回答by Alexandr Priymak

.git is a place where local repository is stored (not the working directory!)

.git 是存储本地存储库的地方(不是工作目录!)

Working directory usually is a directory where the .git directory is placed

工作目录通常是.git目录所在的目录

回答by mayank kumar

Working Directory is where your code resides on local machine. Git Local repo is .git/ which is generally inside the Working Directory. It contains HEAD and various useful info. You can have a look of what it contains:

工作目录是您的代码驻留在本地机器上的位置。Git 本地存储库是 .git/,它通常位于工作目录中。它包含 HEAD 和各种有用的信息。你可以看看它包含的内容:

cd .git 
ls -a

回答by Uttam

Uttams-MBP:project uttamgc$ ls -al

Uttams-MBP:project uttamgc$ ls -al

drwxr-xr-x 9 uttamgc staff 288 Sep 28 14:19 .git

drwxr-xr-x 9 uttamgc 工作人员 288 Sep 28 14:19 .git

In the example above, project is the folder or directory [mkdir] once this folder is created I move into project directory [cd project] then I git init from the folder and create .git subdirectory. [the third row with .git is the local repository]

在上面的例子中,project 是文件夹或目录 [mkdir] 一旦这个文件夹被创建我移动到项目目录 [cd project] 然后我从文件夹中 git init 并创建 .git 子目录。[.git 的第三行是本地存储库]