Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the ".git" mean in a git URL?

Tags:

git

I setup a git repo in foo

cd
mkdir foo
cd foo
git init

Now I want to reference that remotely

git clone git+ssh://me@somemachine/home/me/foo.git

fatal: git remote error '/home/me/foo.git' does not appear to be a git repository

So I take .git off and it works. But nearly every example I see has ".git" at the end. What does that ".git" mean?

Also, what's the difference between ssh://... and git+ssh://... (in both meaning and practical terms)

like image 739
gman Avatar asked Dec 31 '11 06:12

gman


People also ask

What is a .git file?

The . git folder contains all information that is necessary for the project and all information relating commits, remote repository address, etc. It also contains a log that stores the commit history. This log can help you to roll back to the desired version of the code.

Why is .git so large?

As I told, git keeps track of each and every line change you made, it makes its history huge. But git uses a powerful compressing mechanism so that it will make all your codes to tiny tiny chunks. Also it stores the difference in between the files to reduce the size.

How do I find my git repository URL?

On the GitHub website, click on you repository of interest. Locate the green button named Code and click on it. The GitHub URL will appear.


1 Answers

What does that ".git" mean?

.git at the end of a git repository folder is just a naming convention that usually means that the folder is a server and not a client. I believe it's determined by the repository being bare or not (bare repositories have no working directory). The clone URL just points to a folder, if the actual folder has .git at the end, add it. Otherwise, don't.

Also, what's the difference between ssh://... and git+ssh://... (in both meaning and practical terms)

In practical terms they're pretty much the same. In meaning, they're using different protocols to connect to the server. ssh:// opens up an SSH connection to a server with a specific user and runs the git commands on the server (typically the server will restrict the commands by setting the user's shell to /usr/bin/git-shell). git+ssh:// means that the server is running git daemon locally and that clients need to first open an SSH connection to interact with the daemon.

like image 104
Robert Rouhani Avatar answered Sep 27 '22 17:09

Robert Rouhani