gitosis snippets

How to fix "fatal: 'gitosis-admin.git': unable to chdir or not a git archive"

Tagged setup, fatal, gitosis, install, git  Languages bash

Are the SSH keys valid?

When, not if, you get this error you most probably have the wrong keys listed in /home/git/.ssh/authorized_keys:

$ git  clone git@xxx.com:gitosis-admin.git 
Initialized empty Git repository in /Users/christian/Documents/Projects/gitosis-admin/.git/
fatal: 'gitosis-admin.git': unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly

Try removing the keys in authorized_keys one by one, and verify that the names of the users match the ones in .gitosis.conf

http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

Try using the full path to the repository

$ git clone git@xxx.com::/home/git/repositories/xxx.git

Check if the repository exists

$ cd /home/git/repositories/xxx.git
$ git clone /home/git/repositories/xxx.git

What does SSH say?

ssh -v git@xxx.com

Use Google

http://stackoverflow.com/questions/1264262/connecting-to-gitosis-server-through-an-ssh-tunnel http://stackoverflow.com/questions/733057/can-git-work-via-ssh-port-forwarding

Simple script for adding existing project to git/gitosis

Tagged script, git, gitosis  Languages bash
GIT_USER=git
SERVER=xxx.com
APP=xxx

touch tmp/.gitignore log/.gitignore vendor/.gitignore
find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore

cat <<EOF >>.gitignore
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
*.swp
Capfile
EOF

git init
git add .
git commit -m "initial commit" 
git remote add origin $GIT_USER@$SERVER:$APP.git
git push origin master