A Cloudflare Workers-native fork of isomorphic-git, ported to work with the Cloudflare Workers runtime.
- SHA-1 Hashing: Uses
crypto.subtle.digestSync()(Workers-specific synchronous crypto API) - No CommonJS Dependencies: Removed
sha.js,async-lock, andpath-browserify - Pure ESM: All modules are ES modules with no CommonJS fallbacks
- Replaced
sha.jswith nativecrypto.subtle.digestSync() - Falls back to async
crypto.subtle.digest()if needed - Workers-only: No Node.js crypto support
- Replaced
path-browserifywith simple string-based path joining - Sufficient for git operations which always use forward slashes
- Replaced
async-lockwith queue-based implementation
Tests run in actual Cloudflare Workers runtime using @cloudflare/vitest-pool-workers:
# Run Workers-specific tests
npm run test:workers
# Watch mode
npm run test:workers:watchThe original isomorphic-git uses CommonJS modules (require()) which don't work in Cloudflare Workers' ESM-only environment. Instead of using polyfills, we modified the source to use native Workers APIs directly, resulting in:
- Faster performance - Native crypto is faster than polyfills
- Smaller bundle - Fewer dependencies
- No build issues - No CommonJS transformation needed
- Type-safe - Proper Workers types
- Tested - Tests run in actual Workers runtime
# Install dependencies
npm install --legacy-peer-deps
# Build
npm run build
# Test in Workers environment
npm run test:workers
# Format code
npm run formatnpm install @ashishkumar472/cf-git
# or
bun add @ashishkumar472/cf-gitimport git from '@ashishkumar472/cf-git'
import http from '@ashishkumar472/cf-git/http/web'
// All isomorphic-git APIs work the same way
await git.clone({
fs,
http,
dir: '/repo',
url: 'https://github.com/owner/repo',
})Works with:
- Cloudflare Workers
- Cloudflare Pages Functions
- Miniflare (local development)
- Vitest with Workers pool
Does NOT work with:
- Node.js (use original isomorphic-git)
- Browser (no digestSync support)
- Other edge runtimes without Workers APIs
MIT (same as original isomorphic-git)
Based on isomorphic-git by William Hilton and contributors.