-
-
Save gpsarkar/2b82fb69a0e58c3c76badf58ff800e59 to your computer and use it in GitHub Desktop.
Go to onedrive folder in your pc and create a folder for git repository. | |
Usually onedrive resides in `C:\Users\%username%\OneDrive` | |
Open GitBash | |
cd ~/OneDrive | |
mkdir git | |
cd git | |
mkdir myproject | |
cd myproject | |
git init | |
git config --bool core.bare true | |
Now go to your workspace.. generally this will be any folder in your PC, outside of OneDrive.. | |
Never create your workspace in onedrive or it will save all the files from node_modules. | |
Lets say worspace is in D:\workspace | |
Open GitBash | |
cd D:/workspace | |
git clone ~/OneDrive/git/myproject | |
cd myproject | |
touch testfile.txt | |
git add . | |
git commit -m "initial commit" | |
git push origin master | |
Congratulation.. you have a private git repository on cloud. |
does push and pull works with this method? I need to use this method for online CAD collab project.
I got hung up on this for a while.
If you are starting from a working copy you copied to OneDrive you might get an error. Git doesn't like pushing changes to working copies because push only updates the repo, not the working files.
Convert the working copy to a bare repo by moving everything except the .git
directory to a backup location. (Delete them if you're brave.) In the now mostly empty project root run the ... core.bare ...
command from the OP. Now you can clone from and push to the "remote" repo.
Hello, I don't know what was the goal in the first post, but the problem I reported is a condition that started only after the 08-09-2023 Windows 11 update. So, it is a bug created by that release.
In my case ANY .git folder in OneDrive is corrupted after the sync finnishes, so no matter how you create your Git repository, it will be corrupted after OneDrive syncs it with the cloud.
Such a problem does not happen in a Windows 10 computer I have connected to the very same OneDrive account. If a create my Git repository in my W10 computer, the repository will continue to work until I access it from my W11 computer.
Did you find a way to push into the folder? or just commit works.
while push it throws an error saying that it is not "git" repo which makes sense.
I can see git logs and commit