{"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,"search_vec":"'2':31 '2.0.0':23 '2020':25 '401':78 'activ':105 'add':26 'anonym':92 'auth':76 'authent':97 'backend':120 'basic':75 'browser':68 'built':63 'built-in':62 'chang':47 'clone':14 'copi':41 'copy-on-writ':40 'cor':65 'design':33 'execut':54 'fixtur':20 'full':27 'git':2,13,28,57,73,81,87,114,118 'git-http-backend':117 'git-http-mock-serv':1 'git-http-serv':56,113 'git-ssh-mock-serv':86 'header':66 'hook':82 'http':3,58,74,115,119 'http/ssh':8 'includ':61 'isomorph':72 'isomorphic-git':71 'javascript':106 'june':24 'karma':108,111 'karma-middlewar':110 'karma-plugin':107 'key':96 'licens':101 'lightweight':7 'mainten':104 'middlewar':112 'mit':100 'mock':4,9,89 'moder':103 'oper':17 'parallel':52 'password':93 'persist':46 'plugin':109 'prevent':45 'protocol':29 'public':95 'push':16 'releas':98 'repo':49 'repositori':21 'server':5,10,59,90,116 'specif':34 'ssh':84,88 'suit':37 'support':32,51,91 'test':12,19,36,53,69,79 'unlik':55 'use':39 'variant':85 'version':22,30 'write':43","created_at":"2026-04-25T07:37:57.533432+00:00","updated_at":"2026-04-25T07:37:57.533432+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"git-http-mock-server","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/isomorphic-git/git-http-mock-server","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/git-http-mock-server","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","http-networking","auth-security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-25","next_check":"2026-07-24","install_tag":null}}