Monthly Archives: September 2013

I frequently use GitHub to maintain a lot of my personal projects, minor hacks and if I am upto it, contributing to other open source packages. It is like this free (almost) unlimited remote server where you can push all your code. The downside is, unless you pay them some money, all your code ends up being open to everyone. Now if for some reason, you don’t want the code to be public, you might have to buy private space on GitHub or maybe try and apply for the free educational repositories. (Or move to BitBucket, but again the free ones are limited).

However, there is a cheap, albeit risky alternative to that – You can use your Dropbox space (Or Google Drive – if you are a fan of Google reading through your stuff) as a free Git remote server! This is not a fool proof method and the chances for conflicts arising are high if multiple users are pushing code, so it is best recommended for personal work, where only one person is pushing code to the remote repo.

A lot of people have done this before, so this is old news, but I think its a decent hack and worth telling people about it.

The Steps

Let’s move to the command line and set up our repository!

Step 1 :  Move to your Dropbox folder and create a folder (Git in our example) where you will be creating your repositories and initialize a bare repository like this:

 cd ~/Dropbox/Git
git init --bare dropboxrepo.git 

This will create a folder with the name dropboxrepo.git and inside it, you can see that it has all the essentials for a git repository.

Guts of the bare repository

Guts of the bare repository

Now technically you are making this repository on your local machine, but since it is inside the Dropbox folder, you are syncing it to their servers as well, and can access the folder contents anywhere.

Step 2 : Now go the local repository, where you maintain the code that you want to push to your remote repository, and add the above folder as a remote like this:

 git remote add dropboxremote ~/Dropbox/Git/dropboxrepo.git 

Basically what you did here is  add the path to your dropboxrepo.git folder as a remote alias. So now the alias dropboxremote will refer to this folder and will be identified as a remote repository.

Step 3 : Now that you have initialized a remote repo and added it to the remote alias in your local repo, you can now push your code like this:

 git push -u dropboxremote master </code>
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 458 bytes, done.
Total 6 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (6/6), done.
To /Users/abhinav/Dropbox/Git/dropboxrepo.git
* [new branch] master -> master
 Branch master set up to track remote branch master from origin.

After this, you should see the Dropbox spin sign for a while as it syncs all your files. However you will notice that after syncing, you don’t see your files in the folder but the same files you saw before (they are modified now though). But don’t worry all your files are synced. You can now follow the same steps as above and clone this repository on another machine and you will see all your committed code right there!

Word of caution

As I said before, this is not exactly the best way to have your own private remote server (It’s free!) and it comes with its own dangers. Firstly, if you push or pull while the folder is still syncing you might encounter errors like this:

error: unable to find ea2ae105b8955b3f73d79065bc52ee3126cd2e4f
error: refs/heads/master does not point to a valid object!
Your configuration specifies to merge with the ref 'master'
from the remote, but no such ref was fetched. 

If you see this error, just wait for the syncing to finish and try again. If it still doesn’t work, you will have to delete your current remote repo and create a new one and try again.

The above issue occurs frequently if there are a lot of contributors pushing the code to the same remote repo. Of course you can be careful and avoid them, just don’t pull/push while syncing!

I recently started using this method to maintain some of my private projects and it works just fine!

Happy tinkering!

A dedicated Home Server is a useful thing to have if you’re a hacker. You can use it as a remote repository for all your code, for hosting your website, dumping all your media and accessing it with any other device and even printer sharing. This post gives a detailed procedure of making (in my opinion) a near perfect home server using a Cubieboard!

Benefits of using a Cubieboard

Low Cost : For $50, the Cubieboard is like the cheapest computer in the world. Complete with 1GB RAM, 4GB space, 10/100 Ethernet port, two USB ports, SDcard slot, camera interface, audio out, HDMI AND along with all this awesomeness, it also has a complete SATA port. It also comes with a nice glass box for protection.

Low Power : The low cost doesn’t just end there with the pricing, the average power consumption of the Cubieboard is 8W, which if compared to standard low power servers is 5 times less! So it just doesn’t cost less, it consumes less as well!

Getting Started

You will need a functional operating system with SSH and Ethernet ports enabled on the Cubieboard before installing the server stack.In case you haven’t seen already, I have described how to do that in this post. Make sure you have followed the steps and installed a headless Debian on your Cubieboard before reading further. I have released the latest kernel images with fixed patches and SATA power enabled over here.

Now that the SATA is enabled, you can now easily connect a HDD, thus removing any space constraint on your server. (NOTE: The SATA works for a 2.5 inch drive only, for other HDD types, you will need external power source)

To ensure that the SATA interface works on boot, just type this command in your terminal (on the Cubieboard, of course!)

echo "sw_ahci_platform" >> /etc/modules

After connecting the Ethernet port, make sure you note down the IP of your server. You can do that by using the DHCP list or just doing a shell login with the TTL pins and running ifconfig, you will get all the network connection details including the IP.

Now that we have all the hardware and Operating System stuff settled, we consider our server stack options. One of the interesting options is the Napkin Server. It is based on JRuby, Sinatara and Neo4j graph database. The Napkin server offers a REST API with predefined services for storing and retrieving configuration information and collecting time series data from client devices. A plug-in model provides extensibility in HTTP handling and periodic processing of stored data. It is a very interesting project, you can refer to the wiki for Cubieboard installation here.

The second option would be to go for the more traditional LAMP stack. The installation is a very simple 3-step process.

Step 1: Installing Apache 2 and PHP 5

Apache is usually the go-to choice for most linux based servers. You can easily install Apache and configure it with PHP 5 with the package manager tool like this:

 root@cubie:~# apt-get install apache2 php5 libapache2-mod-php5 

The folder holding all the php pages by default is located in /var/www/

To check if php is properly installed, just open a sample php file:

 root@cubie:~# vi /var/www/test_file.php 

and add the following php code

 {codecitation}<?php phpinfo();?>{/codecitation} 

After you have saved this file, you can test by opening a browser on a different machine and connect to the following link: http://%5Bcubieboard’s-ip%5D//test_file.php and you will see this :


Step 2 : Installing MySQL Database server

The next step would be installing the database backbone. Again, installing MySQL is an easy task with the package manager:

 root@cubie:~# apt-get install mysql-server mysql-client php5-mysql 

While installing, you will get be prompted to insert a root mysql password. You can add it there,but in case you forget you can even add it later like this:

 mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=<your password> WHERE user="root";

Step 3 : Installing PHPMyAdmin

PHPMyAdmin is an extremely easy-to-use web-tool to manage the databases on your server. It is a very handy tool to remotely manage databases on your server. To install it simply go:

 root@cubie:~# apt-get install phpmyadmin 

During the installation process, you will be prompted with a screen to choose your choice of web-server. In our case, it is Apache2


Once the installation is complete, to test it, open a browser on a different machine connected in the same network, and open the link : http://%5Bcubieboard’s-ip%5D/phpmyadmin

Doing so will result in this:


To enter, you must use the Cubieboard’s login details. Once you enter the correct values, it should lead you to a Dashboard, which is pretty self explanatory to use!


Now you have a fully functional web-server!! You can now start experimenting with your server, maybe by installing wordpress on it and using it as a host for your own website!

Happy tinkering!