3

I am trying to make a new branch in Gitlab by using Gitolite. I complete the installation steps. when i come across "setting up gitolite" section i have a trouble. I followed this link.

When i run

            gitolite setup -pk alice.pub 

command i got "bash: gitolite: command not found" error message. I don't know what is the problem.. Any one please help me.

Bathakarai
  • 1,517
  • 6
  • 23
  • 39

3 Answers3

1

This step comes after the Gitolite installation, which supposes you have chosen one of three possibilities:

  1. Keep the sources anywhere and use the full path to run the gitolite command.
  2. Keep the sources anywhere and symlink just the gitolite program to some directory on your $PATH.
  3. Copy the sources somewhere and use that path to run the gitolite command.

So make sure gitolite is in your PATH, and that command will work.

I prefer a local installation of gitolite (in a local directory, as opposed to /usr/local, which requires root privileges.).
See, for illustration, "install_or_update_gitolite.sh"

"${github}/install" -to "${gtl}/bin" # Note: "${gtl}/bin" is in my $PATH
GITOLITE_HTTP_HOME= gitolite setup -pk "${H}/.ssh/gitoliteadm.pub"

Note that for gitolite setup to properly work, you might want to set GITOLITE_HTTP_HOME to an empty string first.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I added the Path, Now it expects the .pub file, How to create the file, and where i need to keep??? – Bathakarai Dec 01 '12 at 04:04
  • @Bathakarai see step 2 of https://sites.google.com/site/senawario/home/gitolite-tutorial: you will generate a `id_rsa.pub` (the public key) and an `id_rsa` (the private key) in you `$HOME/.ssh` of your workstation (not necessarily the same than your Gitolite server). You will then need to copy it on the server (as explained in the tutorial I linked) anywhere, but **changing the name `id_rsa.pub` to `yourLogin.pub`**: that is important: read http://sitaramc.github.com/gitolite/glssh.html to understand why, plus some illustration in http://stackoverflow.com/a/13320256/6309) – VonC Dec 01 '12 at 06:55
  • Hi VonC. i have teh same issue as the OP and the step i do not understand is how to add gitollite to my path? i know how to do it via windows OS but i am using this gitolite on a ubuntu server OS and have no clue how to do so. With out it i too get the same error of command not found :( Thanks in advance and we have came across eachother in a similar question and u seem to be the expert :) – Jono Jan 03 '13 at 22:46
  • @jonney You need to update `$PATH` (an environment variable: https://help.ubuntu.com/community/EnvironmentVariables), you can see an illustration there: http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path. – VonC Jan 04 '13 at 06:29
  • @jonney When I install gitolite (https://github.com/VonC/compileEverything/blob/master/gitolite/install_or_update_gitolite.sh), I put it in a directory which is *already* in my `$PATH`, because of my `.bashrc` (http://askubuntu.com/questions/127056/where-is-bashrc, part of the 'DotFiles': http://mywiki.wooledge.org/DotFiles): https://github.com/VonC/compileEverything/blob/master/.cpl/.bashrc.tpl#L82-L84 – VonC Jan 04 '13 at 06:30
  • Cool ok i wil try that. one question i feel is a bit odd, i manually navigated to the gitolite folder and tried running the command and it did not work. Should it not execute gitolite or any App if u manually go into the directory and call the app or script ? – Jono Jan 04 '13 at 09:36
  • @jonney no it should not. That is because `$PATH` should never include '`./`' (current directory): way too dangerous (try a '`ls`' in a directory with a phony `ls` executable, and you get a very different and unexpected result). If you are in a directory with an executable you want to run (like `gitolite`), type: '`./gitolite`' (without the quotes), and it will run, because you explicitly mention its path: '`./`' (current directory). – VonC Jan 04 '13 at 10:00
  • Hi. i tried adding it to my path but it still says it cannot find gitolite . i tried this from the link u sent me : sudo vi /etc/profile.d/SCRIPT_NAME.sh add the line >> export PATH=/gitolite:$PATH and then executed this sudo chmod a+x /etc/profile.d/SCRIPT_NAME.sh – Jono Jan 05 '13 at 18:15
  • @jonney `/gitolite`?: you can put gitolite wherever you want. See my .bashrc file for instance, that I previously mentioned: https://github.com/VonC/compileEverything/blob/master/.cpl/.bashrc.tpl#L82-L84 `export PATH="${PATH}":"${GITOLITE_HOME}/bin"` (of course, that means you define first a `export GITOLITE_HOME="${H}/gitolite"`, referencing the root directory of where you have install gitolite. – VonC Jan 05 '13 at 18:30
  • The gitolite seems to be in my user/bin directory whilst the /gitollite directory just contains a folder called src and the some install files – Jono Jan 05 '13 at 20:01
  • @jonney I am not familiar with an installation that would use /gitolite (as in '/' root system path). I always prefer installing gitolite in a dedicated account (like, for instance, 'git'). In that case, you would add the parent directory of the script you want to execute to the path: `/home/git/gitolite/bin`. Official documentation: http://sitaramc.github.com/gitolite/install.html – VonC Jan 05 '13 at 20:38
  • `Linux debian-srv 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux` `ls: cannot access /home/gitolite/bin: No such file or directory` `ls: cannot access /usr/bin/gito*: No such file or directory` – Fantastory Aug 24 '15 at 08:22
  • @fantastory you can make a new question (referencing to this one) in order to explain your issue. – VonC Aug 24 '15 at 08:25
0

As I also faced the same problem, I found the solution(s) as below.

First way is ...,

Open your terminal and key in below code

$ PATH=$PATH:~/bin

It is because the value of $PATH variable is point to incorrected path.
So I just modify this variable.

To be more detail click here.

Second way is ...,

Edit .bashrc file going to the end and insert below line.

PATH=/home/git/bin:$PATH

To be more detail click here.

Community
  • 1
  • 1
Frank Myat Thu
  • 4,448
  • 9
  • 67
  • 113
0

On debian, there is no /usr/bin/gitolite

Linux debian-srv 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux ls: cannot access /home/gitolite/bin: No such file or directory 
ls: cannot access /usr/bin/gito*: No such file or directory

Here installing gitolite3 helped:

apt-get install gitolite3
root@debian-srv:# which gitolite
/usr/bin/gitolite
Fantastory
  • 1,891
  • 21
  • 25