How to add a local repo and treat it as a remote repo

opensas picture opensas · May 15, 2012 · Viewed 162.3k times · Source

I'm trying to make a local repo act as a remote with the name bak for another local repo on my PC, using the following:

git remote add /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git bak

which gives this error:

fatal: '/home/sas/dev/apps/smx/repo/bak/ontologybackend/.git' is not a valid remote name

I'm trying to sync two local repos, with one configured as a remote named bak for the other, and then issuing git pull bak.

What is the best way to do it?


Edit:

Sorry, silly me, I've just realized the remote add should be:

git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git

the name of the remote goes before the address.

Answer

larsks picture larsks · May 15, 2012

You have your arguments to the remote add command reversed:

git remote add <NAME> <PATH>

So:

git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git

See git remote --help for more information.