You are not logged in.
Note: git is already installed on some servers. If git is already installed on your server you can skip the "Install git" and "Setup .bashrc" parts of step 2.
Installing gitosis isn't very difficult, just:
1) Create a "Custom (Listening on Port)" app named "gitosis".
2) Execute the following commands:
# Install git cd ~/webapps/gitosis wget http://kernel.org/pub/software/scm/git/git-1.6.1.tar.gz tar fxz git-1.6.1.tar.gz cd git-1.6.1 ./configure --prefix=$HOME/webapps/gitosis make make install cd .. rm -fr git-1.6.1* # Install gitosis cd ~/webapps/gitosis ./bin/git clone git://eagain.net/gitosis mkdir -p bin lib/python2.5 PYTHONPATH=lib/python2.5 easy_install-2.5 -d lib/python2.5 -s bin gitosis rm -fr gitosis # Setup .bashrc cd cat >> .bashrc <<\EOF export PATH=$HOME/webapps/gitosis/bin:$PATH EOF source .bashrc # Setup SSH keys. cd ls -d .ssh > /dev/null 2>&1 || mkdir .ssh chmod 711 . chmod 755 .ssh ls .ssh/id_dsa.pub > /dev/null 2>&1 || ssh-keygen -f .ssh/id_dsa -t dsa -N "" gitosis-init < .ssh/id_dsa.pub
That's it. Now all you've to do is setup repos and users. I recommend reading:
http://scie.nti.st/2007/11/14/hosting-g … secure-way
Start at "Here some cool magic happens. Run this on your local machine:". Instead of running the command on your computer run it on the server that your account is on and instead of using:
git XXX git@YOUR_SERVER_HOSTNAME:XXX
Use:
git XXX (Your WebFaction username.)@(Your domain name.):XXX
Hope it helps. ![]()
Offline
OK, I've tried this four ways from Sunday and am looking forward to more ;)
Latest attempts were by following the instructions above:
Currently I have:
'custom app listening on port' -- ~/webapps/gitosis
git 1.6.1 installed in ~/webapps/gitosis/bin
gitosis cloned, installed, path updated, and removed
public key created per instructions
'gitosis' and 'repositories' directories created in ~/ following 'gitosis-init < [key]' which seems to be their placement whether run from ~/ (in directions) or from ~/webapps/gitosis
When from local machine I attempt to 'git clone myusername@mydomain.com:gitosis-admin.git', it asks for myusername's password, I provide; it closes with "fatal: 'gitosis-admin.git': unable to chdir or not a git archive"
I'm wondering:
why 'repositories' is landing in ~/ instead of ~/webapps/gitosis and whether that matters
Oddly enough, I was semi-successful in setting up gitosis in the home directory of a new user I created. In that case, however, I can read and write from my home machine (windohs, at that), but not from a terminal on my webfaction account; same error: 'unable to chdir or not a git archive'
Mercy I beg.
Offline
Did you get any errors while executing the commands? I'll double check but the steps were working for me yesterday.
dhmorgan wrote:
why 'repositories' is landing in ~/ instead of ~/webapps/gitosis and whether that matters
That's normal, see http://eagain.net/gitweb/?p=gitosis.git … E.rst#l85.
Offline
and still not working; I can get to gitosis when logged in under same account but not via ssh as other user (yes, I edited gitosis.conf to include that user, and added the pubkey)
It seems that the problem has to do with ssh, as I cannot scp to account without typing in password even though I've added keys, changed permissions, etc.
Offline
dhmorgan wrote:
"...but not via ssh as other user "
What do you mean by that? Every user will have to use "git XXX (Your WebFaction username.)@(Your domain name.):XXX".
dhmorgan wrote:
It seems that the problem has to do with ssh, as I cannot scp to account without typing in password even though I've added keys, changed permissions, etc.
Was the public key added via gitosis? If so that's to be expected because it uses forced commands:
http://oreilly.com/catalog/sshtdg/chapt … html#22858
Otherwise the contents of ~/.ssh/authorized_keys or the permissions of ~, ~/.ssh, or ~/.ssh/authorized_keys are wrong.
I'm still going to test this again. I've just been busy trying to get our git stack ready to be deployed. ![]()
Offline
If i try to clone the gitosis-admin.git repo, I get the error I was getting before with git:
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
(i'm guessing its some env variable i'm missing along the way..?)
Anyway, I specify using --upload-pack /home/conner/bin/git-upload-pack, and I get
fatal: 'gitosis-admin.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
... not sure how that link helped dhmorgan, but I'm still stuck, I wouldn't mind being able to push/pull only from my own username... but I'm still unable to do even that
If this continues to be impossible to get working, how soon could we expect this 'git stack' to be deployed? I assume that means one-click git deployment on our accounts?
Offline
I just double checked and the instructions that I posted work:
-bash-3.2$ git clone testweb63@web63.webfaction.com:gitosis-admin.git
Initialized empty Git repository in /home/testweb63/gitosis-admin/.git/
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 1), reused 5 (delta 1)
Receiving objects: 100% (5/5), 914 bytes, done.
Resolving deltas: 100% (1/1), done.
-bash-3.2$
conner wrote:
(i'm guessing its some env variable i'm missing along the way..?)
Since you installed git in ~ instead of ~/webapps/gitosis you may need to add "export PATH=$HOME/bin:$PATH" to your .bashrc.
conner wrote:
If this continues to be impossible to get working, how soon could we expect this 'git stack' to be deployed?
Every time I set a date something comes up and I miss the date so... When it's done.
conner wrote:
I assume that means one-click git deployment on our accounts?
Maybe, but not yet. If we ever create a git app it'll probably just be gitweb until gitosis is more mature.
Offline
I started over from scratch, following your steps verbatim - I'm getting the same error dhmorgan's getting, without the upload-pack nonsense:
If i run that git clone command you have, git clone testweb63@web63.webfaction.com:gitosis-admin.git, but with my info, ie user = conner, etc, the server responds with:
fatal: 'gitosis-admin.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
-------
I couldn't seem to interact with the repositories remotely, or directly, so I created a directory on the server, and checked them out using that command.
Worked. I made some changes, added them, committed them (to the gitosis.conf file). Which seemed to work.
However I checked that file, ~/gitosis.conf, and it didn't show any of those changes.... (ACK!)
I made the changes manually (not kosher probably), trying to follow along with the instructions here:
http://eagain.net/gitweb/?p=gitosis.git … E.rst#l85. after "Managing It"
So, I manually made those changes to the ~/gitosis.conf file (since checking it out, altering, then pushing seemed to have no effect on the file)
On my own machine (still following along the "Managing it" instructions), creating "myproject" etc... long story short, tried to push it to the server, and I get that same error :
fatal: 'myproject.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
Seems pretty consistent....
Frustrating, no?
Offline
David,
Thank you for the informative reply and especially for working on the Git stack. Also, I apologize for errors I might be introducing because of my ignorance of ssh.
IAIHMB wrote:
dhmorgan wrote:
"...but not via ssh as other user "
What do you mean by that? Every user will have to use "git XXX (Your WebFaction username.)@(Your domain name.):XXX".
If I open an ssh session, logged in as mywebfactionname@mydomainname, I can clone, push, etc. But if I attempt to do the same while logged in under a different account, or from home (ie. '[homeuser@homenet ~]$ git clone mywebfactionname@mydomainname:gitosis-admin.git'), it asks for and accepts the password, then fails with "can't chdir or not git repository"
IAIHMB wrote:
dhmorgan wrote:
It seems that the problem has to do with ssh, as I cannot scp to account without typing in password even though I've added keys, changed permissions, etc.
Was the public key added via gitosis? If so that's to be expected because it uses forced commands:
http://oreilly.com/catalog/sshtdg/chapt … html#22858
Otherwise the contents of ~/.ssh/authorized_keys or the permissions of ~, ~/.ssh, or ~/.ssh/authorized_keys are wrong.
I'm still going to test this again. I've just been busy trying to get our git stack ready to be deployed.
I've deleted, recreated, and changed their permissions.
I'm going to review latest postings, try one more time, then file a ticket.
Danny
Offline
dhmorgain:
So what you're saying is you aren't able to push/pull from your local machine to the server? you're only able to push/pull when you're logged into your webfaction account via ssh to/from you're server?
I can't imagine that being terribly useful ; )
I think thats where I am too
At this point, I'd settle for being able to push/pull from my local machine to the remote (webfaction) repository. I don't mind if its on my primary account or whatnot
No light at the end of the tunnel yet, ; ) but thanks David for putting all the time in, we'll get it
Cheers,
// Conner
Offline
Success!
Thank you Pygi, David, others. Here's what I did, best as I can recall. Try and reply, we'll get a good set of instructions yet.
here's a good intro tutorial: http://scie.nti.st/2007/11/14/hosting-g … secure-way
create a new ssh/ftp user in webfaction control panel (https://panel.webfaction.com/user_/list); this seems to be because webfaction users don't have control over ssh setup and gitosis has its own ssh needs/expectations that will conflict with yours;
for remainder of this how-to, the new ssh/ftp user name will be "gitrdone"
start a shell session as yourself
create a 'dsa' pub key
(http://forum.webfaction.com/viewtopic.p … 8323#p8323)
cd
mkdir .ssh
cd .ssh
ssh-keygen -t dsa
[enter] to default filename 'id_dsa'
[enter] for no passphrase
[enter] again to confirm
# see what name@domain is being used
# mine is wfaccount@web16.webfaction.com
more id_dsa.pub
# make copy with name revealed, + '.pub'
cp id_dsa.pub [wfaccount@web16.webfaction.com.pub]
start a shell session as 'gitrdone'
install git and gitosis; I found these good instructions at http://www.simplicidade.org/notes/archi … _gito.html
cd
mkdir src && cd src
# Install Python
wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tgz
tar zxf Python-2.6.1.tgz
cd Python-2.6.1
./configure --prefix=$HOME
make
make install
cd ..
export PATH=$HOME/bin:$PATH
[update: important -- also add the above line to git-user's '.bashrc' file]
# Install setuptools
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
# Install Git
wget http://kernel.org/pub/software/scm/git/git-1.6.1.tar.gz
tar zxf git-1.6.1.tar.gz
cd git-1.6.1
./configure --prefix=$HOME
make
make install
cd ..
# Install Gitosis
git clone git://eagain.net/gitosis.git
cd gitosis
python setup.py install
set up ssh dir and files
cd
mkdir .ssh
cd .ssh
ssh-keygen -t dsa
[enter] to default filename 'id_dsa'
[enter] for no passphrase
[enter] again to confirm
(do not create 'authorized_keys')
chmod 701 ~/
chmod 700 ~/.ssh
initialize gitosis
(does not matter which directory you are in; setup will be relative to --prefix=)
gitosis-init < ~/.ssh/id_dsa.pub
# don't know why this is set up this way, but...
chmod 755 ~/repositories/gitosis-admin.git/hooks/post-update
test installation
(cd to dir to which you'd like to clone; I'll call it 'your-repo')
git clone gitrdone@yourdomain:gitosis-admin.git
If that worked, return for a moment to your wfaccount session and add your pub key to gitrdone's your-repo/gitosis-admin/keydir; you can see that in keydir there's already one for gitrdone@webNN.webfaction.com
scp ~/.ssh/wfaccount@webNN.webfaction.com.pub gitrdone@yourdomain:your-repo/gitosis-admin/keydir/
Now cd to your-repo/gitosis-admin/keydir edit gitosis.conf as desired scie.nti.st article at top is good for this
at minimum, edit [group gitosis-admin]
members = gitrdone@webNN.webfaction.com wfaccount@webNN.webfaction.com
I am preferring 'members = @all' because new users can be added in one step by adding their key to the keydir.
git add, commit, and push from your-repo/gitosis-admin
Return to your wfaccount session, try cloning, etc.
Last edited by dhmorgan (2009-01-13 18:08:54)
Offline
I am trying dhmorgan's latest instructions now. I'll post an update with the results. Can I start from that last post or do I need to follow the instructions from the beginning?
Offline
if gitosis is what you want (multiple secure repositories managed via one ssh account), I'd start with just my instructions because they generally take into account the others
feel free to email me with questions/issues during the process if you don't want to clutter up the discussion before posting your results
Offline
has anyone solved the problem:
fatal: 'gitosis-admin.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
dhmorgan: according to your post#12. the ssh/ftp user that you specify to create. what do we put in the "Shell" value? /bin/bash?
Offline
hi dhmorgan:
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
this gives me an error,
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-7186.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python2.4/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
Any idea?
Offline
mickeyckm wrote:
has anyone solved the problem:
fatal: 'gitosis-admin.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
dhmorgan: according to your post#12. the ssh/ftp user that you specify to create. what do we put in the "Shell" value? /bin/bash?
the 'fatal: unable to chdir' error occurs for more than one reason--often key-related though not necessarily so; it would be nice if this were clearer; here are the things I check;
did I type it in right
is the repo a repo
does repo have proper permissions
can I access this repo directly from the filesystem (ie. 'git clone ~/repos/myproject.git')
is my key right
'/bin/bash' is the shell for which the instructions are written
Last edited by dhmorgan (2009-02-19 07:57:08)
Offline
mickeyckm wrote:
hi dhmorgan:
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
this gives me an error,
error: can't create or remove files in install directory
Any idea?
Yes. The Python that is getting run is the system's 2.4 version. You will want to have your own installation running. If you installed Python and added the PATH export line to the ~./bashrc file, I believe it should run your installed Python instead of the system's.
Offline
I'm trying to follow along at home here and it's still not working. I've followed all these steps exactly, and it's failing at test installation with this:
bash: gitosis-serve: command not found
fatal: The remote end hung up unexpectedly
This is odd as gitosis-serve is in the same ~/bin directory as git is, and if git knows where it is I don't see why it can't find gitosis-serve.
Any pointers on this one?
Thanks,
Eric
Offline
eric wrote:
I'm trying to follow along at home here and it's still not working. I've followed all these steps exactly, and it's failing at test installation with this:
bash: gitosis-serve: command not found
fatal: The remote end hung up unexpectedly
This is odd as gitosis-serve is in the same ~/bin directory as git is, and if git knows where it is I don't see why it can't find gitosis-serve.
Any pointers on this one?
Thanks,
Eric
I'm assuming that is the output from:
' git clone gitrdone@yourdomain:gitosis-admin.git '
I'm wondering if the git that's getting run is the one in ~/bin; if you type 'git --version', is it 1.6.1? does the same result occur if you run '~/bin/git clone gitrdone...'?
Last edited by dhmorgan (2009-02-20 09:21:07)
Offline
Yup, I made sure ~/bin came first in my path. `which git` finds ~/bin/git, the version is 1.6.1, and it still looks like this:
[mygituser@web21 repos]$ ~/bin/git clone mygituser@web21.webfaction.com:gitosis-admin.git
Initialized empty Git repository in /home/mygituser/repos/gitosis-admin/.git/
bash: gitosis-serve: command not found
fatal: The remote end hung up unexpectedly
[mygituser@web21 repos]$ ls ~/bin
2to3 gitk git-shell python
easy_install gitosis-init git-upload-archive python2.6
easy_install-2.6 gitosis-run-hook git-upload-pack python2.6-config
git gitosis-serve idle python-config
git-cvsserver git-receive-pack pydoc smtpd.py
Pretty weird! Thanks for looking at this.
Eric
Offline
Ok ... I was getting the "fatal: The remote end hung up unexpectedly" error.... and I seem to have solved it for one operation (a clone) at least!
At the beginning, I looked at the above instructions by dhmorgan, and thought: "I already have python2.6 installed -- why install again?"... So I created a new git user, and setup to install python libraries in /home/git/lib/python2.6 (n.b. at one point I had to "ln -s /home/git/lib/python2.6 /home/git/lib/python2.6/site-packages" to trick setup.py...)
Initial setup seemed successful, and I was able to connect to gitosis-admin remotely etc, but when I tried to create a second repository, I couldn't do it the way http://scie.nti.st/2007/11/14/hosting-g … secure-way recommends; I also couldn't do it by creating a bare one in /home/git/repositories, and then cloning it remotely. I could generate various error messages, all ending in "fatal: The remote end hung up remotely".
After a several hours of hacking away, I noticed that /home/git/repositories/gitosis-admin.git/hooks/post-update looks like:
#!/bin/sh
set -e
gitosis-run-hook post-update
git-update-server-info
so... we need to have the environment set up for /bin/sh, it would seem?
Accordingly, I added in /home/git/.profile
ENV=/home/git/.shinit; export ENV
to get /bin/sh to read .shinit
and set up PATH and PYTHONPATH appropriately in .shinit... (and did alias python=/usr/local/bin/python2.6 ... appropriate for me)
and now... I was able to create another repository and clone it!
Now... its late, and I'm a bit fuzzy on how I got here exactly, but I believe that the "hung up unexpectedly" is because the python path and/or python executable is not the *right* one due to the environment not being right while git is running in your "git" shell account. So mutate the above recipe to fit your situation.
-- Shaun
PS The tentative tone struck at the end is because the login shell is bash, so the script should have the login environment setup... so possibly I fixed something in my .bashrc (I "cleaned it up" while editing the .shinit) so perhaps the rigamarole with .shinit is unnecessary and/or not sufficient. Did I mention its quite late? :) In any case ... check your environment!
Last edited by shaunc (2009-03-17 01:55:38)
Offline
I am getting this error when trying to clone from my machine using
git clone wfaccount@domain:gitosis-admin.git fatal: 'gitosis-admin.git': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly
Out of curiosity I tried this url and it worked
git clone wfaccount@domain:/home/gituser/repositories/gitosis-admin.git
I also added daemon = yes to my gitosis.conf
So that's solved the problem, but I'd like to know why it's not looking in the repositories folder by default, any ideas anyone?
Offline
gitosis is supposed to look in ~/repositories by default, so I'm not sure why
you need the full path. If you want to try configuring the path, try adding
the following to the [gitosis] section of your gitosis.conf:
repositories = /home/stevehodgkiss/repositories
I honestly do not know if that will solve the problem, but based on the
documentation available at http://scie.nti.st/2007/11/14/hosting-g … secure-way
that's my best answer ![]()
Offline
Hi. I followed the instructions and it worked. But I'm having problems to get the git-daemon running, has someone managed to do it ? I mean, it runs, but It doesn't work, I did a custom application, and I setup the git daemon to run in the assigned port, but it doesn't work. I always get
"
webXX.webfaction.com[0: XXX.XXX.XX.XX]: errno=Connection refused
fatal: unable to connect a socket (Connection refused)
"
Last edited by abuiles (2009-09-20 20:08:59)
Offline