Category Archives: Development

Talking about development practice on IRC

…I do understand that it is tempting, but it is just wrong for the (almost obvious) reasons i already pointed out. There is an easy rule to follow.

You should not start with the wrong approach in the first place. This is why i discourage it completely.

Tell/teach only best practices. Talk about the drawbacks and lessons learned already. Point out what’s wrong with the other approaches as they get mentioned. Stop bad practice at first – if you are in the position.

– Be a good senior!

Often times people do not want to hear what you have to say. Many times they don’t listen and don’t care. Some times they come back and wish they would have.

That’s not your burden though…

Simplest GIT Server (over ssh)

If you should ever come to the need to have your own, personal git server and got shell access almost anywhere – here is how to set it up and use it.

Prerequisites

  • Shell access to a host on the net (this means you do have an user account with ssh login, ftp or the like will not suffice)
  • Optional extra: You are able to create a user to use with git (beforehand) – no need to do so, can be used with your normal user account though
  • Git installed on your machine and the remote, of course

Create a new remote repo

Log in to your (remote) host via ssh:

me@localhost:~$ ssh user@host

The following commands will create a directory called repos in your home dir and create a new git repo called name_of_repo.git there:

user@host:~$ mkdir repos
user@host:~$ cd repos
user@host:~/repos$ GIT_DIR=name_of_repo.git git init

That’s it!

Use it

Back on our local machine we want to clone that repo:

me@localhost:~/work/$ git clone user@host:~/repos/name_of_repo.git

If you already have data you want to put into your new remote repo you can do so as well, just add the new remote to your local git repo like that:

me@localhost:~/work/my_existing_local_git_repo/$ git remote add origin user@host:~/repos/name_of_repo.git

Last step is to push your local changes to the remote repo, as usual:

me@localhost:~/work/name_of_repo/$ git push origin master

And that is all there is to it!

Some extra stuff

Of course you can put your ssh public-key on the remote server, if you have not already done so, not to have to enter your password everytime you use git.

If you have created an extra git-repo user on your remote host, you can even give access to the repos to others by putting their ssh public-keys in the ~/.ssh/authorized_keys2 file.
WARNING: Be aware that they will have full shell access too, if you do not limit the according keys to only beeing able to use git! – Feel free to ask for details…