Tag Archives: git

Fixing a broken Git repository

After having several hard kernel crashes, some of my files ended up empty on my disk. I then got errors like:

error: object file .git/objects/81/b43db0dadcafe18eef75c60c57cc496d523d83 is empty
error: object file .git/objects/fb/9b5b3daa56c7833be66f0eaac2b5a906474627 is empty

I can recommend this Wiki page on kernel.org which tells how recovery basically should be done. This post shows some of those steps a bit more “hands-on”. I started with moving this corrupt (empty) object away, and then got this message when doing some git operations:

fatal: unable to read 81b43db0dadcafe18eef75c60c57cc496d523d83

Read more »

git send-email and SMTP with SSL

On Fedora 20, when using git send-email I always got this error:

Unable to initialize SMTP properly. Check config and use --smtp-debug. VALUES: server=my.server.com encryption=ssl hello=my.host.com port=465 at /usr/libexec/git-core/git-send-email line 1255.

Even using the suggested parameter –smtp-debug 1 did not help, I get the exactly same output with that parameter. In the end, it turned out the self-signed certificate is not accepted right away (which of course is good) but lead to no specific error message (which is not so good). However, using the parameter –smtp-ssl-cert-path “” disables certificate verification, which already allowed me to send the e-mail.

However, one want to install the certificate in a way that its always accepted. git send-email relies on OpenSSL certificate database. In order to add an additional CA certificate one has to add it to /etc/pki/tls/certs and create a symlink to its hash.

$ curl http://url.to/root.crt -o myroot.crt
$ openssl x509 -noout -in myroot.crt -fingerprint

If you are paranoid, and you should be nowadays, verify your fingerprint at this point 🙂

# mv myroot.crt /etc/pki/tls/certs
# cd /etc/pki/tls/certs
# openssl x509 -in myroot.crt -out myroot.pem -outform PEM
# ln -s myroot.pem `openssl x509 -hash -noout -in myroot.pem`.0

Update:
This works also for Arch Linux, however the OpenSSL certificates are located under /etc/ssl/certs/. Also for SMTP with SSL to work, the following packages are needed

pacman -S perl-net-smtp-ssl perl-authen-sasl

Zenphoto Dokuwiki integration

For a small web project I recently decided to use Zenphoto as photo gallery and Dokuwiki as Main page. I wanted that Dokuwiki and Zenphoto share they’re user database. But both ways, neither Zenphotos user database in Dokuwiki nor Dokuwikis user database in Zenphoto seemed to be simple to implement. So I ended up in a Dokuwiki plug in which synchronize the user database with Zenphotos user database. For that purpose the plug in need the MySQL login information for Zenphotos database. It also allows to enable auto login for Zenphoto when login on Dokuwiki (by simple setting the right cookie). I created a Github repository and added a plug in wiki page to the Dokuwiki website. I thought it might be useful for anybody else…

Using git to install dokuwiki

Since some months now I use Subversion to update my WordPress installation. A simple “svn switch” to the new tag does the trick, and your WordPress installation is up to date! Since my Dokuwiki installation are getting older and older, I decided doing that with Dokuwiki as well. The source code of Dokuwiki is hosted in a Git repository over at Github. I found nowhere a short instruction how to do that with git, so I thought I write one.

First of all, you need git to install git (always strange to install such software on a server, but who cares :-))

sudo aptitude install git-core

When you already have a Dokuwiki installation, you have to convert it to a git repository. Because git clone doesn’t allow using a non-empty directory, we have to work around this limitation. Warning: Using this method you will loose any changes made to Dokuwiki specific files. Configuration and data should be in their own files so you won’t loose such data.

git clone -b stable -n http://github.com/splitbrain/dokuwiki.git
mv dokuwiki/.git/ .
rmdir dokuwiki
git checkout -f

When you are going to install a new installation, use this command

git clone -b stable http://github.com/splitbrain/dokuwiki.git wiki

For security reasons its recommend to disallow the .git directory for HTTP requests by adding these lines to the .git/.htaccess file. You should also remove install.php.

rm install.php
vi .git/.htaccess
order allow,deny
deny from all

To update your installation, just use the command git pull, which will pull the latest commits from the original Github repository.

git pull