gitolite - how to clone and push to repo that's created under a "user" folder

476 views Asked by At

ok so first off, i have to apologize in advance for being such a git / gitolite noob.

ok so now..

problem

there is a folder on my git server that looks like this:

mstgit:/var/git/repositories/user/johnd/tmp.git# ls
HEAD         branches     config       description  gl-creator   hooks        info         objects      refs
mstgit:/var/git/repositories/user/johnd/tmp.git# 

And it shows up in our web inteface (gitolite i guess??) as an empty folder.

I'm trying to clone it using the following command:

localdev:/var/git/mystuff/projectX# git clone [email protected]:user/johnd/tmp.git
Cloning into 'tmp'...
Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

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

I don't understand why i'm getting permission denied. I created the user repo on the git server. I logged into the server using the same ssh key that I used to log into the "localdev" box.

Here are the file permissions on the johnd folder, in case it matters:

mstgit:/var/git/repositories/user/johnd/tmp.git# ls -lah
total 44
drwxr-sr-x    7 git      git         4.0K Dec 16 20:01 .
drwxr-sr-x    3 git      git         4.0K Dec 16 20:01 ..
-rw-r--r--    1 git      git           23 Dec 16 20:01 HEAD
drwxr-sr-x    2 git      git         4.0K Dec 16 20:01 branches
-rw-r--r--    1 git      git           66 Dec 16 20:01 config
-rw-r--r--    1 git      git           73 Dec 16 20:01 description
-rw-r--r--    1 git      git            5 Dec 16 20:01 gl-creator
drwxr-sr-x    2 git      git         4.0K Dec 16 20:01 hooks
drwxr-sr-x    2 git      git         4.0K Dec 16 20:01 info
drwxr-sr-x    4 git      git         4.0K Dec 16 20:01 objects
drwxr-sr-x    4 git      git         4.0K Dec 16 20:01 refs

Also, the contents on gl-creator is "johnd" which is my ssh id name. not sure what else i should check.

2

There are 2 answers

0
VonC On

If you have access to the gitolite-admin repo, you should check the access control rules.

You should check to what you have access with the info command.

ssh git@host info

You can also, on the gitolite server side, check the ~git/.gitolite/logs folder for the audit log which will mention which rule rejected your clone.

0
mnr On

5 years later but still not solved.. so

According to this

You need to check 2 items.

  1. First your user have read access to desired repo in conf/gitolite.conf file. this can be achieved by editing gitolite-admin repo. (authorization)
  2. Second you need to check your user have access to gitolite server (authentication)

You can use ssh or https approach. For ssh you need to define your public key in advance, for https you need to define a user pass on apache config of gitolite.

git clone https://user:pass@host/git/user/johnd/tmp
git clone git@host:user/johnd/tmp.git

And other matters are as Vonc said.