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.

  • “Git Clean -fdx” recovery… possible?
  • What is the difference between git reset and git revert?
  • How to bring the git remote branch references local
  • Git ignore all files in directory but not directory
  • Merging Git Flow Feature Branch after Hotfixes?
  • Push failed: Could not get a logplex token for this app
  • Nuget Package restore with git submodule
  • Team City Git “Host key verification failed”
  • Internal NuGet Package Management In Large Solutions
  • Renaming remote git branch
  • Git Shelve vs Stash
  • Update Eclipse project with local repository changes push
  • 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@127.0.0.1:/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.

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