Category Archives: Git

Warning: push.default is unset; its implicit value is changing in Git 2.0

Here is what can be found under push.default in the documentation:

  • current – push the current branch to update a branch with the same name on the receiving end. Works in both central and non-central workflows.
  • upstream – push the current branch back to the branch whose changes are usually integrated into the current branch (which is called @{upstream}). This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow).
  • simple – in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one. When pushing to a remote that is different from the remote you normally pull from, work as current. This is the safest option and is suited for beginners. This mode has become the default in Git 2.0.
  • matching – push all branches having the same name on both ends. This makes the repository you are pushing to remember the set of branches that will be pushed out (e.g. if you always push maint and master there and no other branches, the repository you push to will have these two branches, and your local maint and master will be pushed there). Default before Git 2.0.

I chose to use simple by using the suggested command:

git config --global push.default simple

 

Apache2 with Git Smart HTTP

Install git-core and apache2. Also make sure required modules are loaded:

apt-get install git-core apache2
a2enmod cgi alias env rewrite

To create a git server with smart protocol, I used the following script in /var/gitwww:

#!/bin/bash

WORKDIR=`pwd`
REPO=$1

# create dir
echo $REPO
mkdir -p $REPO
cd $REPO

# init repo
git init --bare
touch git-daemon-export-ok
cp hooks/post-update.sample hooks/post-update
git config http.receivepack true
git update-server-info

chown -R www-data:www-data .

# done
cd $WORKDIR

And I configured my default virtualhost as following:

VirtualHost *:80>
        ServerAdmin webmaster@localhost

        SetEnv GIT_PROJECT_ROOT /var/gitwww
        SetEnv GIT_HTTP_EXPORT_ALL
        ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

        Alias /git /var/gitwww
        <Directory /usr/lib/git-core>
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
# for apache 2.4 (ubuntu 14.04+) use the following line instead of the 2 above:
#               Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

After that restart your apache and create a master branch from your client:

git clone http://_server_/git/_project_
cd _project_
touch README
git add .
git commit -m 'initial commit' -a
git push origin master

 

JBoss JDBC Module Creator

Every time I download a new jboss I have to add the needed jdbc module manually. And every time I have to look how the module.xml has to look like. So I decided to write a simple script that creates a module for PostgreSQL. with some configuration, it should be capable of creating every jdbc module you want. Just see the options it supports.

You can see my project at github: https://github.com/mbogner/jboss_module_creator

Here some instructions how to run it with default options:

[codesyntax lang=”bash”]

git clone https://github.com/mbogner/jboss_module_creator
cd jboss_module_creator
./jboss_module_creator.pl

[/codesyntax]

gitolite create new repository

First add an entry in your gitolite-admin/conf/gitolite.conf

repo <REPONAME>
    RW+     =   <KEYNAME>

REPONAME is the name of the new repository and KEYNAME is the key in the keydir without .pub. After adding this entry commit your change and push it to your repository.

After that create your new project locally and push it to your repository:

cd REPONAME
git init
git add .
git commit -m 'initial commit' -a
git remote add origin git@YOUR_SERVER_HOSTNAME:REPONAME
git push origin master:refs/heads/master
git push --set-upstream origin master