Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a reason why you shouldn't mix ssh and smart http access with git?

I have set up a git server using gitolite for a small team. One of us created a repo and pushed the initial commits using smart http - let's say it resides at

http://ourhost/project.git

I then proceeded to clone the project using ssh i.e.

git clone git@ourhost:project.git

Git let me do it and created the project folder but reported that the repo was empty. Furthermore any git pull I did gave me "couldn't find remote ref master" errors. When I then ran

git remote -v show origin 

It showed HEAD branch: (unknown). When I checked on the server (runs gitlab) I could see the master branch and all the code so it was clearly there.

Finally I cloned it using smart http and lo and behold it all worked and I can get on with it.

But why is this? Why should it matter which method each of us use to push/pull? Gitlab even shows the two URLs (for ssh or smart http) as alternatives for repos so it seems to be expected to work...)

Or am I missing something...?

like image 280
SonarJetLens Avatar asked Oct 21 '22 12:10

SonarJetLens


1 Answers

With GitLab V4, and Gitolite, ssh remains the prefered method of access.
Https access could bypass completely Gitolite.

Since GitLab V5 doesn't use Gitolite anymore (but now uses gitlab-shell instead), both ssh and https access can be used more consistently with the access right management.

like image 181
VonC Avatar answered Nov 02 '22 04:11

VonC