I am using github to do some private repository hosting. However, everything is still under github server. So is it really private? I am not entirely sure about that…
Here is my solution to make repository more secured and private.
I started by reading this article. http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux. It is an excellent starting point to follow a step by step guideline to create your own repository through your own server by using git core.
In the above article, we know that we can create a git user under Linux system, create or copy authorized_keys file and allow ssh. And we can also create an empty repository by a few lines of commands.
However, I am developing most applications in Windows, so I will need to make Git working in Windows environment.
I use the resource git installer from this site: http://git-scm.com/. The version I use is 1.8.2 when writing this post.
Install the git and run git bash software to run a terminal in Windows. Now the first thing we need to do is to get ssh keys. We can simply run “ssh-keygen” command in git bash terminal and create a pair of public and private keys.
And then we need to copy the value of public key (from id_rsa.pub) into my git server. From above article, we have firstname.lastname@example.org. Thus, we can ssh into email@example.com and open .ssh/authorized_keys file to paste the public key value from my development Windows machine.
And then we can try to clone repository into my development machine in git bash as this “git clone firstname.lastname@example.org:repository/test.git”. About this command, email@example.com is having git as user name under yourserver.com. And in server, under git user name folder, I created a folder called “repository” and then I initialized an empty git repository; thus, I have the structure of “repository/test.git”.
Note that, in git bash, every time when we try to do git pull/push, we may get ‘stdin: is not a tty’ error message. You may have to follow this link to get it fixed. http://webhostingneeds.com/Git_stdin_is_not_a_tty
Cheers. I am happy to save some little money without using github but git core in my own server.