1

I am trying to setup gitolite on Ubuntu Server! It seems to work as I could clone gitolite-admin

But when I try to issue the command on the client

git clone gitolite@ubuntu-server:testing

It ask for a password for gitolite, but my ssh password that I configured on the client is not accepted

Have I done anything wrong somewhere?

I did copy the .pub to the server and ran gl-setup without problems

NB: I am very green with git

Morten Hagh
  • 2,055
  • 8
  • 34
  • 66

1 Answers1

1

Check the content, on the server gitolite account, of:

 ~/.ssh/authorized_keys

You should see your public key within a gitolite start / gitolite-end:

#more authorized_keys
# gitolite start
command="/home/gitolite/bin/gitolite-shell gitoliteadm",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ABCAB3NzaC1yc2EAAAADAQABAAABAQCxy5Y1epgjph3h439etAognIP4rlpDlD0OBh2rh+9DHMwlMad04zb3Tah5HQ
10Zg7mFWvltZlIBdhk5cBr3/mN1dNiRFspKwD2Z0yQaaI23zjHnXRAgLV76SOImICUt9CfCtGOy6jQH+2x4j921DL2cT8Ib+RslhBUEUdc3qNvOQSNhIz2qTVHJ676ohGFiqitgswIVIk6WRS+fERx6JFy9o7rLnnOCrozHYU271TwFgYqfNS7TuV4ZFwTP04hDGN+YALjvcQ0KGQGY/7qok+h5nHoRh9RDTeSJ2gDK2M4QPrTCzkCa0ebCexP2lR9G0iXYcClzXitttKDH7cls0j Gitolite Admin access (not interactive)
# gitolite end

Make sure to use the latest gitolite (V3), which is the case if you have:

/path/to/gitolite/bin/gitolite-shell

(you can execute: gitolite-shell xxx on the server to check what version you are using)

Make also sure to not protect (at least at first) your private ssh key with a password.

If it keeps asking you for a password, edit your question with the content of:

ssh -vvv gitolite@ubuntu-server

The OP adds:

If I run git clone morten@ubuntu-server:testing and type my password everything works well... But now I can't seem to push anything to the repository

That means now the ssh part is running properly, however don't forget your first push must be a:

git push origin master

(see "git push origin master:refs/heads/master what does this do")

That is because the default push policy (which might change soon) is to push matching branches (and if you didn't push anything yet, there wouldn't be a master branch on the remote repo yet)

The other trick is to make sure you are on a branch before pushing

git checkout master
git push

(and not trying to push while you are in a detached head mode)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • If I run git clone morten@ubuntu-server:testing and type my password everything works well... But now I can't seem to push anything to the repository – Morten Hagh May 23 '12 at 13:02
  • Nevermind .. forgot to set master! :) It seems to work as it should for what I want to use it for! :) Thanks for the answer – Morten Hagh May 23 '12 at 13:10
  • 1
    @MortenHagh: good! Did you change anything in order for the `git clone` to work? – VonC May 23 '12 at 14:52
  • Thanks for this great answer! :-) I did not change anything besides the user on the ssh. Gitweb also seems to work! Adding a new project/repository seems a bit hard as I ssh onto the server and mkdir a new folder in /repositories/ and then git init etc. but might just be easier when I get used to it. – Morten Hagh May 23 '12 at 20:46
  • @MortenHagh just to be sure: you don't ssh in order to add/create new repos with gitolite. You declare a new repo in the local clone of the `gitolite-admin` repo, and you push that repo. Gitolite will parse its `gitolite.conf` file and create the new repos appropriately. See http://sitaramc.github.com/gitolite/repos.html – VonC May 24 '12 at 05:55
  • Arh.. Thanks a lot! I read on a guide that I had to ssh to create new repos. But I might have misread it. :) But thanks again! :) – Morten Hagh May 24 '12 at 06:17
  • @MortenHagh and make sure to upgrade to gitolite V3 (no more `gl-xxx` commands) Support will be easier with an up-to-date version of Gitolite. See http://sitaramc.github.com/gitolite/g3why.html and http://sitaramc.github.com/gitolite/install.html#migr – VonC May 24 '12 at 06:25
  • Thanks :) I will do that! :) Just one more question! I am working on my projects in /var/www/ Can I add the projects to the repositories from there, or do each project have to be put into the same folder as gitolite-admin ? – Morten Hagh May 24 '12 at 07:32
  • Gitolite will store those new repos in its `repositories` directory, alongside the `gitolite-admin` repo. That doesn't prevent you to clone said new repos anywhere you want (provided you clone them through gitolite: `git clone git@server:reponame`). See http://sitaramc.github.com/gitolite/user.html – VonC May 24 '12 at 07:37