Category: System Administration

For work I need to use git to manage various aspects of client projects, and because the code is proprietary, I have to manage a private git system. The way you do this is to create a user called git and to setup your authorized keys for that user. Then you make sure the user is using the git-shell with “chsh git -s $(which git-shell)” and make sure that you echo $(which git-shell) >> /etc/shells.

On my local machine I have a script like so:

#!/bin/bash
mkdir -p $1
cd $1
git init
ssh admin@mygitserver -p 1337 "bash /home/admin/make-git-repo $1"
git remote add origin ssh://git@mygitserver:1337/home/git/$1.git
git pull origin master
if [ ! -f .gitignore ]; then
	cp ~/bin/gitignore_template .gitignore
	git add .
	git commit -a -m "Initial Commit of $1"
	git push -u origin master
else
	git branch master --set-upstream-to=origin/master
fi

On my server, I have a bash script like so:

#!/bin/bash
if [ "$1" = "" ]; then
	echo "You must name the repos, don't add .git!";
	exit 1;
fi
if [ -d "/home/git/$1.git" ]; then
	echo "/home/git/$1.git already exists";
	exit 0;
fi
mkdir /home/git/$1.git
cd /home/git/$1.git
git init --bare
cd ../
chown git:git -R $1.git

That way I can just cd into a directory and type: addrepo some-project. And it gets created on the server, and setup, or if it is already on the server, it pulls it down. Bada-bing.

You may have been the happy recipient of this warning from Hetzner: “We have received a security alert from the German Federal Office for Information Security (BSI).” In which case, you most likely have samba running, and need to turn it off:

try: service samba stop

To make it permanent, open up /etc/init.d/samba and put exit 0; after the shebang line.

Enjoy.

Run this command in the same folder you saved setup-x86_64.exe to:

.\setup-x86_64.exe -q -P wget -P gcc-g++ -P make -P diffutils -P libmpfr-devel -P libgmp-devel -P libmpc-devel -P cmake -P cmake-gui -P gdb -P git -P libboost-devel -P python3 -P chere -P gnu-free-fonts -P xinit

Sometimes you find a website that is just awesome, and you want a local copy of it. Here is how you do it:

#!/bin/bash
H='--header'
wget -mkEpnp -w 3 $H='Accept-Language: en-us,en;q=0.5' \
$H='Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
$H='Connection: keep-alive' \
-U 'Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2' \
--referer=http://www.google.com/ $1

Put the above into a file called mirror.

chmod 777 mirror

Then mv the file to a location in your path, like $HOME/bin if you have that, or /usr/sbin or some other place. The above will go slowly, so that you don’t spam the server with too many requests. It will also help you avoid causing errors on their site if they depend on certain headers for statistics or routing.