{"id":18386,"library":"git-http-mock-server","title":"git-http-mock-server","description":"A lightweight HTTP/SSH mock server for testing Git clone and push operations against test fixture repositories. Version 2.0.0 (June 2020) adds full Git Protocol Version 2 support. Designed specifically for test suites, it uses copy-on-write to prevent persistent changes to repos and supports parallel test execution. Unlike git-http-server, it includes built-in CORS headers for browser tests with isomorphic-git, HTTP Basic Auth for 401 testing, and Git hooks. The SSH variant (git-ssh-mock-server) supports anonymous, password, and public key authentication. Released under MIT license with moderate maintenance activity.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/isomorphic-git/git-http-mock-server","tags":["javascript","karma-plugin","karma-middleware","git-http-server","git-http-backend"],"install":[{"cmd":"npm install git-http-mock-server","lang":"bash","label":"npm"},{"cmd":"yarn add git-http-mock-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add git-http-mock-server","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires native git installed for git-http-backend process.","package":"git","optional":true}],"imports":[],"quickstart":{"code":"// No programmatic API; CLI usage shown below\n// Step 1: Install as dev dependency\n// npm install --save-dev git-http-mock-server\n// Step 2: cd to a directory with bare git repos\n// For example: __fixtures__ containing test-repo1.git\n// Step 3: Start the HTTP server\n// $ git-http-mock-server\n// Step 4: In another shell, clone and push\n// $ git clone http://localhost:8174/test-repo1.git\n// $ git push http://localhost:8174/test-repo1.git main\n// For SSH version:\n// $ git-ssh-mock-server\n// $ git clone ssh://localhost:2222/test-repo1.git\n// To run as daemon:\n// $ git-http-mock-server start\n// $ # do tests\n// $ git-http-mock-server stop\n// Environment variables:\n// GIT_HTTP_MOCK_SERVER_PORT (default 8174)\n// GIT_SSH_MOCK_SERVER_PORT (default 2222)\n// GIT_HTTP_MOCK_SERVER_ROOT (default cwd)\n// GIT_HTTP_MOCK_SERVER_ALLOW_ORIGIN (default *)\n// GIT_SSH_MOCK_SERVER_PASSWORD (set for password auth)","lang":"javascript","description":"Installs and runs the mock server via CLI, demonstrating clone/push operations and daemon mode with environment variables."},"warnings":[{"fix":"Ensure git is installed on the machine and available in PATH.","message":"Version 2.0.0 drops support for git-http-backend npm module, requiring native git installation.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Install build tools if using npm install; consider using pre-built binaries.","message":"SSH server requires the ssh2 npm module, which may have native compilation issues on some platforms.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always run start/stop from the same working directory.","message":"The server writes PID file to current working directory; running 'start' and 'stop' from different directories will not stop the server.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install git and ensure it's available in your system PATH.","cause":"git is not installed or not in PATH.","error":"Error: spawn git-http-backend ENOENT"},{"fix":"Set GIT_HTTP_MOCK_SERVER_PORT to a different port, e.g., export GIT_HTTP_MOCK_SERVER_PORT=9000","cause":"Port 8174 is already in use by another process.","error":"Error: listen EADDRINUSE :::8174"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}