Placing a github repo into a cloud synced folder (GDrive, Dropbox, iCloud, OneDrive etc)

Cloud synced folders will try to sync the .git folder. This folder has all the information that Git use to version control your project. Have GDrive, Dropbox, iClode, OneDrive, ... manipulating those files can be a little problematic. For example, on PC1 and PC2 you might have

$ cat .git/HEAD
ref: refs/heads/master

If on PC1 you change branches, you will end up with

$ git checkout foo
Switched to branch 'foo'
$ cat .git/HEAD   
ref: refs/heads/foo

GDrive, Dropbox, iClode, OneDrive, ... will notice that .git/HEAD and will add it to the synchronisation queue. At some time, PC2 will receive instructions to update .git/HEAD. Have your branch changed on PC2 might be something that you didn't want to happen. Is also possible that Git on PC2 will find some temporary problem because the synchronisation didn't finished, for example HEAD is one commit that doesn't exist on PC2.

2 Likes