Skip to content

Manamama/GH-Clone-Helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

GH-Clone-Helper 🚀

#version 3.0.3

Just use: git2!

This one https://github.com/libgit2/libgit2: git2 version 1.9.0

git2 --help
usage: git2 [--help] [-c <key=value>] [--config-env=<key=value>] [--no-pager]
             [--version] <command> [<args>...]

These are the git2 commands available:

   blame        Show the origin of each line of a file
   cat-file     Display an object in the repository
   clone        Clone a repository into a new directory
   config       View or set configuration values
   hash-object  Hash a raw object and product its object ID
   help         Display help information
   index-pack   Create an index for a packfile
   init         Create a new git repository

See 'git2 help <command>' for more information on a specific command.

Here is why:


🔍 OSI Layers Where git2 Excels

⚙️ Layer 4: Transport (TCP-level keep-alives and connection handling)

  • libgit2 implements its own keep-alive logic over HTTP(S) and SSH subtransports. Unlike classic Git, it doesn’t rely solely on the system's TCP behavior.
  • From issue #5133: there's ongoing work to implement keep-alive for the receiving side of the smart protocol, because the original Git was too rigid here (github.com).
  • It resets connection flags properly and reconnects substreams if needed (git.kmx.io).

🧩 Layer 5–6: Session / Presentation (HTTP/SSH session management)

  • libgit2 supports session reuse and proper reconnect logic:

    • It offers hooks and reconnection strategies to recover gracefully from broken TLS/SSH sessions .
    • It fine-tunes buffer sizes (16 KB TLS packets) to avoid partial reads and unintended stalls (fossies.org).

📦 Layer 7: Application (Git packfile streaming and protocol)

  • Implements smarter pipelining for HTTP(S) and SSH — being able to restart or continue smart fetches rather than abort entirely.
  • Manages subtransports (smart, ssh, http, https, git) more robustly (stackoverflow.com), maintaining modularity and allowing finer control over retries and failure recovery.

🛠 Why Standard Git Falls Short

  • The official Git CLI uses a single-packfile pushdown: if the live stream fails, it's all aborted.
  • There are no client-side retries or keep-alives built into the packfile logic.
  • Reconnection requires starting the entire fetch/clone operation from scratch.

✅ Summary Comparison: libgit2 vs Classic Git

OSI Layer Classic Git libgit2 ("git2")
Transport (L4) Relies on OS-level TCP, no keep-alive layer Implements its own keep-alive and reconnect logic (reddit.com)
Session (L5–6) One-shot session per clone/fetch Reuses sessions, can re-establish broken ones, adjusts TLS buffer readings
Application (L7) Single monolithic smart protocol stream (packfile) with no restart Modular transport, retries missing packs or refs, robust against intermittent failures

🧭 Bottom Line

  • Libgit2 is built with a layered, resilient architecture that reinstantiates connections, respects keep-alives, and safely retries failed operations.
  • Classic Git is optimized for LAN, fast atomic fetches with no error tolerance for interruptions—it fails hard rather than recover.

That difference at OSI layers 4 through 7 explains why git2 clone can cope with a 59 B/s flaky mobile network without failing, while git clone crashes mid-pack.

⬛⬜⬛⬜⬛
⬜⬛⬜⬛⬜
⬛⬜⬛⬜⬛

About

A convenient shell function to clone GitHub repositories via gh and not gitclone using the GitHub CLI with authentication support for rate-limited accounts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages