Registry / devops / git-fetch-pack

git-fetch-pack

JSON →
library0.1.1jsnpmunverified

Implements Git's smart fetch-pack protocol for downloading packfiles (clone/fetch) and listing remote branches. Version 0.1.1, last updated in 2013. Low-level library that requires manual stream plumbing and does not support side-band protocols by default. Unmaintained with no recent releases, not suitable for production.

npm install git-fetch-pack
INSTALL
IMPORT
SIG · GIT-FETCH-PACK
G
git-fetch-pack
devopsjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
var client = require('git-fetch-pack')()
import client from 'git-fetch-pack'
Not an ESM module; no default export, factory function.
client
var client = require('git-fetch-pack')()
Factory invocation returns client duplex stream.
Ref objects
// Ref object structure documented in README
var Ref = require('git-fetch-pack').Ref
No exported Ref class; refs are plain objects.

Shows how to clone/fetch using git-fetch-pack with net, transport, and repo loading.

var net = require('net'); var clientFactory = require('git-fetch-pack'); var transport = require('git-transport-protocol'); var load = require('git-fs-repo'); var walk = require('git-walk-refs'); load('/path/to/repo/.git', function(err, git) { if (err) { console.error(err); return; } var refs = git.refs(); var hashes = refs.map(function(x) { return x.hash; }); var tcp = net.connect({host: 'github.com', port: 9418}); var want = function(ref, ready) { if (ref.name === 'refs/heads/master') { ready(true); } else { ready(false); } }; var client = clientFactory( 'git://github.com/chrisdickinson/plate.git', want, walk(git.find, hashes) ); client.refs.on('data', console.log); client.pipe(transport(tcp)).pipe(client); client.pack.pipe(process.stdout); });
Debug
Known issues
deprecatedNo updates since 2013; unmaintained and likely broken with modern Node.js.
fix
Use modern git wrapper like 'simple-git' or 'nodegit'.
affects: >=0.1.1
breakingDoes not support side-band protocols by default; may fail with GitHub's git:// protocol.
fix
Manually enable side-band capabilities if supported.
affects: <=0.1.1
gotchaFactory function returns a duplex stream; must pipe both ways (client.pipe(transport).pipe(client)).
fix
Ensure proper stream piping pattern.
affects: <=0.1.1
Errors
Common errors & fixes
Error: connect ECONNREFUSED 192.30.255.113:9418
Git protocol port 9418 blocked or host unreachable
fix
Use SSH or HTTPS instead, or ensure firewall allows port 9418.
TypeError: client.pipe is not a function
Factory not invoked (missing parentheses)
fix
Call the factory: var client = require('git-fetch-pack')();
Error: Not a git repository
Path to .git folder incorrect
fix
Provide absolute path to the .git directory.
readable stream ended before packfile received
Side-band not supported, server response truncated
fix
Enable capabilities or use different protocol.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
git-transport-protocolrequiredrequired for TCP transport
git-fs-reporequiredneeded to load local repository refs
git-walk-refsoptionalused to generate have-stream for fetch
Agent activity
2 hits · last 30 days
node
2
Resources
git-fetch-pack — npm install git-fetch-pack · libregistry