Keeping .git folder outside of dropbox

Dropbox tends to have problems with git files. Making duplicates etc. However, I would like it to back up some elements that I may not necessarily include in my git repositories and also track changes that I haven’t yet commit to git.

I have a great solution for this when it’s a brand new git repo (git init)

  • Single-developer Git with Dropbox backups: seeking safe, simple configuration
  • Why is putting git repositories inside of a Dropbox folder not recommended?
  • Sharing a git repository stored on dropbox
  • Why can I pull from a bare repo on dropbox?
  • Install git and backup in dropbox
  • Why would you use Dropbox but also Git for your Emacs initialization file?
  • I change directories to the project folder in dropbox and in a terminal:

    git --git-dir=~/git_storage/my.git --work-tree=. init && echo "gitdir: ~/git_storage/my.git" > .git

    It works exactly as I would expect. It replaces the .git folder in the working directory with a text file .git containing the directory in which the git files are actually stored. All of this – outside of dropbox. Leaving only the .git text file to be synced.

    However, I’d like to know how to have the same setup (.git directory outside of dropbox) for a cloned or, already existing repository.

  • Writing GIT Extension Allowing files in different branches/heads to coexist in same directory
  • Files showing as modified directly after git clone
  • capistrano rails app has parent folder in git
  • Disable tag deletion
  • Should I use `git push --force` in my build step
  • How to check post buffer size before clone git repository?
  • One Solution collect form web for “Keeping .git folder outside of dropbox”

    If the repo already exists in Dropbox (ie, you cannot clone it with the --separate-git-dir=<git dir> mentioned by charlesreid1), you can:

    • move the .git outside of DropBox
    • set GIT-DIR to the new path of the .git

    That way, you go on working in your Git repo (whose working tree remains in Dropbox like before), but your git commands will use the .git repo which is now outside Dropbox (even though I had bad experiences before, and use git bundle instead).

    Git Baby is a git and github fan, let's start git clone.