Reputation: 153
I want to make a local push destination on my hard disk on Git, and use that destination(folder) for push and pull instead of adding an remote repository. How do I do that in Git?
Upvotes: 15
Views: 6643
Reputation: 2726
Follow these steps:
Go to the folder you want to have your remote in
$ cd /path/to/my-remote
Create a bare repository there via git init
$ git init --bare
Go to the repository you want to work in and add a new remote pointing to the previously created repository via git remote add
$ git remote add <name-of-remote> /path/to/my-remote
After these steps you should be able to push to your new remote <name-of-remote>
$ git push -u <name-of-remote> master
Where -u
is used to set the upstream of your branch, only needed the first time you push.
Upvotes: 30