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

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


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.


If your goal is to keep a local copy of the repository for easy backup or for sticking onto an external drive or sharing via cloud storage (Dropbox, etc) you may want to use a bare repository. This allows you to create a copy of the repository without a working directory, optimized for sharing.

For example:

$ git init --bare ~/repos/myproject.git$ cd /path/to/existing/repo$ git remote add origin ~/repos/myproject.git$ git push origin master

Similarly you can clone as if this were a remote repo:

$ git clone ~/repos/myproject.git


It appears that your format is incorrect:

If you want to share a locally created repository, or you want to take contributions from someone elses repository - if you want to interact in any way with a new repository, it's generally easiest to add it as a remote. You do that by running git remote add [alias] [url]. That adds [url] under a local remote named [alias].

#example$ git remote$ git remote add github git@github.com:schacon/hw.git$ git remote -v

http://gitref.org/remotes/#remote