How can I set up my own local Git server on my own computer?
I want to use my own server (i.e. 127.0.0.1) when I use the push command. How can I set up my own server?
I’m using MacOS X.
2 Solutions collect form web for “How can I set up my own local Git server on my own computer?”
You don’t need a server to push to a local repository. You can just use a local file url as indicated in the git-push manual:
For local repositories, also supported by git natively, the following syntaxes may be used:
Mat already provided a correct answer for the common case, but if you want to test networked commits locally, the easiest way is to set up an ssh daemon on your machine (if OSX doesn’t already installs one by default – not sure).
Once ssh is set up, you can push to any repository on your local machine by setting up a remote:
git remote add repo-name email@example.com:/path/to/your/repo git push repo-name branch-name
Keep in mind that repositories that are intended for pushing to (remotely or locally) should generally be initialized with
git init --bare; or at least not have any branch you intend to push checked out in the working tree.