agate
Version, currently 0.1.13 versions
- 0.1.2latestApr 30, 2026
- 0.1.1not indexedApr 27, 2026
- 0.1.0not indexedApr 27, 2026
gitlab.com/bjjb/agate
Crystal bindings to libgit2, inspired by rugged
Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
agate:
gitlab: bjjb/agate
version: ~> 0.1.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Agate
Crystal bindings to libgit2, inspired by Rugged.
Prerequisites
Install libgit2 via your package manager:
# macOS
brew install libgit2
# Alpine
apk add libgit2-dev
# Ubuntu / Debian
apt-get install libgit2-dev
# FreeBSD
pkg install libgit2
Installation
Add the dependency to your shard.yml:
dependencies:
agate:
gitlab: bjjb/agate
Then run shards install.
Note: shards install does not install libgit2 itself — you must
install it via your system package manager (see Prerequisites above).
Usage
require "agate"
# Open an existing repository
repo = Agate::Repository.open("/path/to/repo")
# Initialize a new repository
repo = Agate::Repository.init("/path/to/new/repo") do |opts|
opts.initial_head = "main"
opts.mkpath = true
end
# Read HEAD
commit = repo.last_commit
commit.message # => "Initial commit\n"
commit.author # => Agate::Signature(@name="...", @email="...")
# Stage and commit
index = repo.index
index.add("README.md")
index.write
tree = Agate::Tree.lookup(repo, index.write_tree)
sig = Agate::Signature.now("Name", "email@example.com")
Agate::Commit.create(repo, "Add README", tree, sig, sig, [commit])
# Diff
diff = commit.diff(repo)
diff.patch # => "diff --git a/..."
# Clone
cloned = Agate::Repository.clone_at("https://gitlab.com/user/repo.git", "/tmp/repo")
# Branches, tags, remotes
repo.branches.each { |b| puts b.name }
repo.tags.each { |t| puts t.name }
repo.remotes.each { |r| puts "#{r.name}: #{r.url}" }
API Documentation
Full API docs are available at crystaldoc.info.
Contributing
See src/README.md for the source code style guide and spec/README.md for testing conventions.
crystal tool format # format code
./bin/ameba # run linter
crystal spec # run tests
See BUILDING.md for Docker-based cross-platform testing.
License
MIT — Copyright (c) 2025 JJ Buckley
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- Apr 27, 2026
- Commit
08e08341514a- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
gitlab.com/bjjb/agate
Metadata
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
- Synced
- Aug 16, 2026
- Versions
- 3