Working with Git Repository in OneDrive
There have been some rare occasions when I like to work with git repository in OneDrive. It may not be best practice, but it get work done!
After spending some time searching on Internet, i stumbled on this solution.
Instead of having .git folder in the root of teh repository, git allows you to have magic .git file.
In the .git file, add this:
gitdir: /path/to/.git
Example
Check out the
gitrepository somewhere on your local machineCreate a new project folder on OneDrive
Move content from (except or
.gitfolder) to project folder on OneDriveCreate a new
.gitfile in root of project folder on OneDriveAdd path to
.gitfolder in the.gitfile in root of project folder on OneDrivegitdir: /path/to/.git
Now you can run git from your project folder on OneDrive without syncing git data.
Windows
You can use double backslash on Windows:
gitdir: P:\\path\\to\\.git