A couple of days ago GitHub decided to freeze Iranian accounts and Iranian repositories and a lot of us lost access to our repositories. So I decided to write about a solution to keeping backups from your Git repositories using Dropbox.
The easiest way to do this is to create a bare Git repository inside your Dropbox folder.
git init --bare ~/Dropbox/hello-world.git
Assuming the name of your project folder is “hello-world”, the above command creates a Git bare repository in your Dropbox folder. Now you just need to get to your project folder and add this repository as your project remote.
cd ~/Projects/hello-world git remote add dropbox ~/Dropbox/hello-world.git
Next, you just need to make your own changes to the project and commit it so that you can push the changes into this repository. If the project is already active, all of your branches will be transferred to this new repository using the following command and the reset will be done by the Dropbox service itself.
git push -u dropbox --all
It should be noted that Dropbox only keeps information about your project and does not have the usual Git hosting services such as GitHub. If you need more than just a back-up for your project, you should look for other services (most of them already sanctioned Iranian users) or install a dedicated repository on your own server.