How can I set up my own local Git server on my own computer?

I want to use my own server (i.e. when I use the push command. How can I set up my own server?

I’m using MacOS X.

  • Keeping two files in sync between two repositories - symbolic links? or another way?
  • Is it easier to manage code with Git or Bazaar?
  • Removing '.git' directory from git repo?
  • GIT hook to prevent an experimental branch pushed to a release, or master branch
  • What does it mean when git says a file “needs update”?
  • git commit config on initial commit but never again?
  • replace remote repository with local repo, but keep commit history of remote
  • Any way to guarantee that a git user doesn't use fake account info when commiting and pushing?
  • git stuck on Unpacking Objects phase
  • What is the right way to maintain a “version for the server” - with only config files changed, in Git?
  • How to prevent git from quitting when I use TAB completion?
  • Stuck at fetch due to authentication issue
  • 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:

    • /path/to/repo.git/
    • file:///path/to/repo.git/

    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 user@
      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.

    Git Baby is a git and github fan, let's start git clone.