how to setup a OneDrive folder as a git repo?


I created a folder on OneDrive called My files>GitHub>MedAverter. I note it’s url:

I downloaded GitHub Desktop and set the Current repository to the newly created MedAverter folder.

I navigate to my local code folder in git bash:

I enter the following command:

git remote set-url origin

To check it is correct, I do:

git remote -v

here is the output:

origin (fetch)  
origin (push)

Note that it is shorter than the original?

I do a git status and see a bunch of unstaged files, as expected. I stage them with

git add .

Then I commit the files with:

git commit -m "first commit"

Then push the files with:

git push -u origin master

But get error:

fatal: not
valid: is this a git repository?

What am I missing?


In order to use an HTTP remote for Git, it either has to support the smart protocol, which requires a special server endpoint, or it has to support WebDAV, which is commonly referred to as the dumb protocol. In addition, the remote cannot use query parameters, since Git will not handle them.

If you want to use OneDrive with WebDAV, you’ll need some way to get the initial repository structure up to the server, which will likely involve using a standard WebDAV client to upload a directory created with git init --bare.

As mentioned, you’ll also need a WebDAV URL that doesn’t include any query parameters; if OneDrive can’t provide that, then you’d need to use a different provider.

Do note that you should not use OneDrive as a syncing tool for your Git repository across machines because doing so can cause corruption.

Answered By – bk2204

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published