I'm used to create some manually-made repositories to push code to my pet server or share code inside my company. I use the URL ssh://user@ip/folder.git to add as remotes to my workspaces.

I was wondering how services like GitHub set repository URLs without the protocol spec, like git@github.com:igorsantos07/Restler.git.

  • 2
    git@github.com:igorsantos07/Restler.git is same as ssh://git@github.com:igorsantos07/Restler.git – phoops Mar 22 '14 at 13:28
  • That's not my question, man! – igorsantos07 Mar 22 '14 at 21:40

If you take a look at the Git book accessible here: 4.1 Git on the Server - The Protocols there is mention of the various formats for the protocols that Git will accept.


Probably the most common transport protocol for Git is SSH. This is because SSH access to servers is already set up in most places — and if it isn’t, it’s easy to do. SSH is also the only network-based protocol that you can easily read from and write to. The other two network protocols (HTTP and Git) are generally read-only, so even if you have them available for the unwashed masses, you still need SSH for your own write commands. SSH is also an authenticated network protocol; and because it’s ubiquitous, it’s generally easy to set up and use.

To clone a Git repository over SSH, you can specify ssh:// URL like this:

  $ git clone ssh://user@server/project.git

Or you can use the shorter scp-like syntax for SSH protocol:

  $ git clone user@server:project.git

You can also not specify a user, and Git assumes the user you’re currently logged in as.

Services such as GitHub play other tricks with the access to repositories by essentially wrapping the access using HTTP and then emitting the correct protocols out the backside of the HTTP server. This is typically done as a reverse proxy of sorts. A product that you can use that gives you some of these capabilities is called Gitolite (TOC or Intro) as well as Gitorious.

  • oops!! my question was exactly answered by that "shorter scp-like syntax". That's what I wanted, and I didn't noticed there was a collon there. Thanks! – igorsantos07 Mar 23 '14 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.