Is there any difference between git clone xxx and git clone xxx.git?

What is the difference between

git clone https://github.com/octocat/Spoon-Knife and git clone https://github.com/octocat/Spoon-Knife.git?

Jun.08,2021

is followed by whether or not to add a url,. Git depends on the format of the url provided by the resource you are using.
github is now compatible with both url formats.


there is essentially no difference. It's just that the remote file system is named differently.

but as far as git is concerned. There are still some details to know.
git init is used to initialize a warehouse.
git init-- bare is used to initialize a pure repository.
Pure Warehouse means that there is only a version library, not a working directory. It is often used as a remote repository for development teams. Store the code centrally. Without a workspace.
We know that the code you cloned yourself has a hidden folder in the root directory. Git / this is where the metafiles of the version library are stored.

so habitually: if you want to initialize a pure repository, you will name the directory in the form of yourproject.git. To make it clear that he is a pure warehouse that does not contain a workspace.


now that you know the answer, answer it yourself.

1. git will help you make up .git , but will not help you get rid of .git .

when you use git clone xxx , git will first look for xxx , if not, go to xxx.git ;
when you use git clone xxx.git , git will only look for xxx.git .

2. xxx.git is bare repositories (server side), xxx is working tree (local)

3. Whether you use git clone xxx or git clone xxx.git will eventually go to xxx.git .

4. git init-- bare generate bare repositories

will only receive push, not local development. The files / folders generated by
are directly in the specified directory, as shown in the figure left below.

5. git init generate working tree

for local development. The files / folders generated by
are in the .git directory under the specified directory, as shown in the following figure to the right .

clipboard.png

< hr >

reference:


in fact, I also want to know the difference. I have looked up a lot of information and need to add .git after git clone.

Menu