0

I am working entirely locally. I have an existing local git repository that I would like to push to a bare repository (created with git init --bare) that also exists locally on my laptop. Both the bare repo and existing repo exist within the same folder system in c: drive and I am using windows 10.

I cannot find any references online that have worked for adding a remote that is a local repo. Typically online sources reference GitHub or azure as the remote repo URL.

I have tried:

git remote add origin c:\Users\MyName\OneDrive\Desktop\MyBareRepo

and

git remote add origin c:\Users\MyName\OneDrive\Desktop\MyBareRepo.git

and

git remote add origin file://c:\Users\MyName\OneDrive\Desktop\MyBareRepo

and

git remote add origin file://c:\Users\MyName\OneDrive\Desktop\MyBareRepo.git

and

git remote add origin file:////c:\Users\MyName\OneDrive\Desktop\MyBareRepo

and

git remote add origin file:////c:\Users\MyName\OneDrive\Desktop\MyBareRepo.git

I am not sure if it is because git just cannot utilize a local location as a remote, if its because the folder is located in c drive, if I must first adjust the access rights to the folder, if its because its connected to onedrive, or if because of the path format.

CR333
  • 1
  • 1
    Why use the full path when `..\MyBareRepo` might do it? – evolutionxbox Jul 01 '22 at 18:13
  • 1
    What error do you get when you try the commands? Did you remove the old origin, before you set a new one? `git remote show origin` gives you the path used as origin. Also see: https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository?rq=1 – Paul Smith Jul 01 '22 at 21:51
  • 1
    There is, as far as I know, no reason that the *path* should fail. However, storing a Git repository in a network-synchronized area (such as OneDrive) is usually a very bad idea: the network sync software competes with Git in terms of how to name files, resolve changes to files, and so on. Whenever the network sync software wins this competition, Git breaks. So don't do that. – torek Jul 02 '22 at 08:31
  • Agree, it is not good practice. But for quick and dirty things I do it too and it does not fail too often. – Paul Smith Jul 02 '22 at 12:15

0 Answers0