Initialize git in your project and we will add and commit all your files.
~/ $ cd your-project
~/your-project $ git init
~/your-project $ git add .
~/your-project $ git commit -m "first commit"
Change directory to dropbox. Create a directory named git if you don’t have one already:
~/your-project $ cd ~/Dropbox/
~/Dropbox/ $ mkdir git
~/Dropbox/ $ cd git
Initialize a bare git named your-project.git and change directory back to your project.
~/Dropbox/git $ git init --bare your-project.git
~/Dropbox/git $ cd ~/your-project
Add the drop remote to your project. Instead of using the standard remote name of origin, use dropbox. This way it ensures if you ever want to add a second remote location, you can still name it origin.
~/your-project $ git remote add dropbox ~/Dropbox/git/your-project.git
~/your-project $ git push -u dropbox master
Once the remote is set, we push the previously committed changes. And that is all, now your git repo will be in the cloud as a backup and for free.
For Google Drive, the steps to follow are the same, except of using the Dropbox folder, you will use the Google Drive folder. The Google Drive sync app needs to be installed and downloaded.