Many people use Dropbox as a git repository. And why not? It’s compatible across many different platforms, a secure cloud storage service, and easy to setup and begin using immediately. I use it the most when switching between operating systems or even different machines entirely. It’s a great place to centralize my projects, and keep them all up to date across multiple platforms with ease.
When using Dropbox, I maintain several different repository directories; one directory for each language. For instance, my PHP repositories are put into the “repo_PHP” and C# projects in the “repo_csharp”, python “repo_py”, etc.
It’s easy to forget a series of commands, so I’ve put together a simple cheat sheet that I use whenever I need to create a new repository in Dropbox. I keep this cheat sheet in Dropbox as well so that I always know where it is when I need it.
If you aren’t already using it, I suggest you install the Git Extensions application for Windows. The application comes with many tools and resources. Among them, you’ll receive the “Git Bash” which is where you’ll enter the following commands. The Git Bash emulates the Terminal found in Linux distributions, and many of the most used commands will process as they would in Linux.
Lets walk through the cheat sheet.
A quick note:
– The pound “#” signs are comments.
– The sample projects name will be sample_project.
# Go to project directory. ~/sample_project # Initialize a new git project $ git init # Add all files to the new git project for commit # Don't forget to add the period ".", this includes # all current files $ git add . # Commit the project $ git commit -m "Initial commit" # We've completed the commit on our project. Now to # initialize our repo. # Go to our repository in Dropbox $ cd ~/Dropbox/repo # Initialize a bare project # It's usually best to name the repo after the # project you are working on $ git init --bare sample_project.git # Go into new project and check success $ cd sample_project.git # Go back into the original project $ cd ~/sample_project # Add remote repo to project $ git remote add origin ~/Dropbox/git/sample_project.git # Push the original commit to the new project.git repository $ git push -u origin master
All software discussed in this post can be found at the following links.
Download the cheat sheet here: