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

Question

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?

Answer

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.

How do I make a branch point at a specific commit? [duplicate]

Why does git perform fast-forward merges by default?