Hi I am using git for a while now however I am new to enterprise git. here Is what I did with my test-repo I created a ssh key pair and added public key to my test repo as deploy key. Now I can clone my test-repo from ssh and https however when I add someone as collabrator they're able to clone repo from https but not from ssh

ssh-keygen -b 4096 -t rsa -f example_rsa -P "" -C ""

$ ls
example_rsa     example_rsa.pub

$ git clone git@git.example-private.com:star/test-repo.git
Cloning into 'test-repo'...
Warning: Permanently added the ECDSA host key for IP address '' to the list of known hosts.
warning: You appear to have cloned an empty repository.

Same git repo can't be accessed by user even after granting access via ssh however user can git clone the repo using https.

git clone git@git.example-private.com:star/test-repo.git
Cloning into 'test-repo'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

git clone https://git.example-private.com/star/test-repo.git
Cloning into 'test-repo'...
warning: You appear to have cloned an empty repository.

Git uses several protocols for client-server communication:

  • http
  • https
  • ssh
  • git

When you decide to use ssh for you git server, you need to provide relevant ssh access for the collaborators who are going to work with your repositories. There are plenty of solutions to ease the manage - gitlab (it has GUI too), gitolite and many others. Git even comes with a git-shell - if you set it to a newly created user, he will be only able to work with git, and not ssh into the server. Using ssh is more secure and is the better solution (my opinion) for enterprise environments.

When you use https for transport protocol you get the advantages (or limitations) of https. It is most commonly used when you have a web interface for your git server (e.g. cgit) and it allows users to clone repositories (but not to push).

Please have a look at this - a detailed explanation about the protocols used in Git.

  • Thanks for the information however I am still confused about the which protocol is been used when I use git clone git@git.example-private.com:star/test-repo.git My user is not able to git clone the repo. – Shailesh Sutar Feb 16 '17 at 12:50
  • that's ssh - git clone user@address:/repo/location/repo.git – 13dimitar Feb 16 '17 at 12:53

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.