Wednesday, July 6, 2011

gitosis

osx how to install gitosis
http://sitaramc.github.com/gitolite/doc/1-INSTALL.html
back on the gitolite track

as root do the following:

root method

On your workstation:

copy your ~/.ssh/id_rsa.pub file to /tmp/YourName.pub on the server
On your server, as root:

git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
# defaults to being the same as:
# src/gl-system-install /usr/local/bin /usr/local/share/gitolite/conf /usr/local/share/gitolite/hooks

# to upgrade gitolite, repeat the above commands. Make sure you use the
# same arguments for the last command each time.

# create your "hosting user" if not already created
useradd git

su - git

# (now as git)
gl-setup /tmp/YourName.pub
On your workstation:

git clone git@server:gitolite-admin

Note: things to look for:

The git user has to have ssh login ability, you may have to turn that on in the GUI, system preferences --> Sharing remote access

had to add a file for the git user:
.bashrc

containing:
$ cat .bashrc
export PATH=:/usr/bin:/usr/local/bin:$PATH:
#export PATH=$(git --exec-path):$PATH

export GIT_EXEC_PATH=/usr/libexec/git-core

# get the path with $ git --exec-path





6July2011

needed help from this source too
http://www.justlogged.com/Question/1/5041067/4e549dc7aa65302b9e71c9941b815058/show

ran the following command (running google's binary install of git:
$ git --exec-path
/usr/libexec/git-core


my .bashrc file now looks like this

$ cat .bashrc
export PATH=:/usr/bin:/usr/local/bin:$PATH:
#export PATH=$(git --exec-path):$PATH

export GIT_EXEC_PATH=/usr/libexec/git-core


also important, I used the GUI in Snow Leopard 10.6.8 to create the git user. The git user is not an administrator, therefore they were blocked from ssh, I had to manually add them to the users who could ssh in system preferences sharing.


instructions that worked from this source
http://lukhnos.org/blog/en/archives/162

  1. create in system preferences a user git, make the user an admin for a short while, undo this later
  2. create a group git, and add the user to the group
  3. for convenience, I also created a gitosisadmin admin user. (why? was this needed? perhaps to avoid making the git user admin and then removing it requiring a reboot.)

  4. login as the gitosisadmin user and download gitosis.

    ssh -l gitosisadmin localhost
    $ which python
    /usr/bin/python
    $ which git
    /usr/bin/git
    $ pwd
    /Users/gitosisadmin


    $ git clone git://eagain.net/gitosis.git
    $ cd gitosis/
    $ sudo python setup.py install


  5. create key if you don't have one

    ssh-keygen -t rsa


  6. copy key to a temp location so git user can read it
    cp ~/.ssh/id_rsa.pub /tmp/my_key.pub

  7. $ sudo -H -u git gitosis-init < /tmp/eabolden.pub Initialized empty Git repository in /Users/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /Users/git/repositories/gitosis-admin.git/






  8. may need this:
    make sure post update hook is executable.

    sudo chmod 755 /Users/git/repositories/gitosis-admin.git/hookspost-update







  9. from a different account clone the admin repository

    $ git clone git@your.server.com:gitosis-admin.git
    Cloning into gitosis-admin...
    bash: gitosis-serve: command not found
    fatal: The remote end hung up unexpectedly



    tried reinstalling...
    saw this error:
    Searching for setuptools==0.6c12dev-r85381
    Reading http://pypi.python.org/simple/setuptools/
    Reading http://peak.telecommunity.com/snapshots/
    No local packages or download links found for setuptools==0.6c12dev-r85381
    error: Could not find suitable distribution for Requirement.parse('setuptools==0.6c12dev-r85381')


    used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools

    wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
    $ tar xfvz setuptools-0.6c11.tar.gz
    $ cd setuptools-0.6c11
    python setup.py build
    sudo python setup.py install






  10. Notes


    The following can be done with the osx gui

    list users and uid
    $ sudo dscl . list /Users kid
    list groups and group id
    $ sudo dscl . list groups did
    delete user username
    $ sudo dscl . -delete /Users/username
    delete group groupname
    $ sudo dscl . -delete /groups/groupname

    manually create group commandline
    sudo dscl . create groups/git
    sudo dscl . create groups/git did 401

    manually create user commandline
    sudo dscl . create users/git
    sudo dscl . create users/git uid 401
    sudo dscl . create users/git NFSHomeDirectory /Users/git
    sudo dscl . create users/git gid 401
    sudo dscl . create users/git UserShell /bin/bash
    sudo dscl . create users/git Password '*'

    create home directory
    sudo mkdir /Users/git
    sudo chown git /Users/git
    sudo chgrp git /Users/git






    ********************
    not sure if this next part is necessary

    $ cat .bashrc
    #export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:$PATH

    export PATH=/usr/local/bin:/usr/local/git/bin:$PATH

create in system preferences a user git, make the user an admin for a short while, undo this later create a group git, and add the user to the group for convenience, I also created a gitosisadmin admin user. login as the gitosisadmin user and download gitosis. ssh -l gitosisadmin localhost $ which python /usr/bin/python $ which git /usr/bin/git $ pwd /Users/gitosisadmin $ git clone git://eagain.net/gitosis.git $ cd gitosis/ $ sudo python setup.py install create key if you don't have one ssh-keygen -t rsa copy key to a temp location so git user can read it cp ~/.ssh/id_rsa.pub /tmp/my_key.pub $ sudo -H -u git gitosis-init < /tmp/eabolden.pub Initialized empty Git repository in /Users/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /Users/git/repositories/gitosis-admin.git/ make sure paths work correctly with remote connections $ echo "export PATH=$PATH" > ~/.bashrc add to the .bashrc file, export PATH=$(git --exec-path):$PATH it should look like: export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin export PATH=$(git --exec-path):$PATH make sure post update hook is executable. sudo chmod 755 /Users/git/repositories/gitosis-admin.git/hookspost-update from a different account clone the admin repository $ git clone git@your.server.com:gitosis-admin.git Cloning into gitosis-admin... bash: gitosis-serve: command not found fatal: The remote end hung up unexpectedly tried reinstalling... saw this error: Searching for setuptools==0.6c12dev-r85381 Reading http://pypi.python.org/simple/setuptools/ Reading http://peak.telecommunity.com/snapshots/ No local packages or download links found for setuptools==0.6c12dev-r85381 error: Could not find suitable distribution for Requirement.parse('setuptools==0.6c12dev-r85381') used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz $ tar xfvz setuptools-0.6c11.tar.gz $ cd setuptools-0.6c11 python setup.py build sudo python setup.py install wget wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010 tar xfvz setuptools-0.6c8.tar.gz cd setuptools-0.6c8 python setup.py build sudo python setup.py install OLD Tries side note, gitolite next try use from here: https://github.com/sitaramc/gitolite/blob/pu/doc/1-INSTALL.mkd sudo /usr/bin/python setup.py install had the following error: ImportError: No module named setup tools used solution from: http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools wget wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010 tar xfvz setuptools-0.6c8.tar.gz cd setuptools-0.6c8 python setup.py build sudo python setup.py install Notes The following can be done with the osx gui list users and uid $ sudo dscl . list /Users kid list groups and group id $ sudo dscl . list groups did delete user username $ sudo dscl . -delete /Users/username delete group groupname $ sudo dscl . -delete /groups/groupname manually create group commandline sudo dscl . create groups/git sudo dscl . create groups/git did 401 manually create user commandline sudo dscl . create users/git sudo dscl . create users/git uid 401 sudo dscl . create users/git NFSHomeDirectory /Users/git sudo dscl . create users/git gid 401 sudo dscl . create users/git UserShell /bin/bash sudo dscl . create users/git Password '*' create home directory sudo mkdir /Users/git sudo chown git /Users/git sudo chgrp git /Users/git

No comments:

Post a Comment