Why do some repository URLs end in .git while others don't?
Solution 1:
The convention is that the .git extension should be used for bare repositories, and left off of directories with a working tree. Git doesn't really care, but has a few convenience methods that make this fairly transparent.
For example, if you have a repository named /tmp/foo.git and you call git clone file:///tmp/foo
, Git will first try to find /tmp/foo. If it doesn't exist, it will try /tmp/foo.git instead.
This does not work the other way around. If your directory is named /tmp/foo and you try to clone from /tmp/foo.git you will be told:
fatal: '/tmp/foo.git' does not appear to be a git repository
Most of the HTTP/HTTPS functionality is from your web server, not Git. Even if you're using Smart HTTP transport, I suspect most of the magic happens in a server-side LocationMatch directive. Theory aside, some quick tests against GitHub show that it works the same way as the SSH and Git procotols in that respect, but your mileage may vary on other web servers.