Available Clients
Gitaly supports client libraries in multiple languages:Go Client
Official Go client with connection pooling and sidechannel support
Ruby Client
Ruby client used by GitLab Rails and gitaly-ruby
Client Usage in GitLab
As of Q4 2018, the following GitLab components act as Gitaly clients:- gitlab-rails: The main GitLab Rails application
- gitlab-shell: Handles
git clone,git push, etc. via SSH - gitlab-workhorse: Handles
git clonevia HTTPS and serves raw Git data - gitaly-ssh: Manages internal Git data transfers between Gitaly servers
- gitaly-ruby: Handles RPCs that interact with multiple repositories (e.g., merging branches)
Connection Formats
Gitaly clients support multiple connection formats:Unix Socket
TCP (Insecure)
TLS
Authentication
Gitaly uses token-based authentication to secure RPC calls. Authentication is handled differently by each client:Token-Based (Go)
The Go client usesgitalyauth.RPCCredentialsV2 to inject authentication tokens:
Bearer Token (Ruby)
The Ruby client generates time-based bearer tokens using HMAC:Connection Pooling
Both client libraries support connection pooling to reuse established connections: Go: ThePool type manages connections by address and tokenRuby: Uses gRPC’s built-in connection management Connections are automatically reused for the same address and authentication token combination.
Common Features
Health Checks
Clients can verify server health using gRPC health checks:Request Metadata
Clients inject metadata into requests:- Authorization: Bearer tokens for authentication
- Client Name: Identifies the calling client
- Correlation ID: For request tracing (handled by interceptors)
- Distributed Tracing: OpenTracing context propagation
Keepalives
Clients are configured to send keepalive pings to maintain long-lived connections and detect server failures quickly.Sidechannel Support
For high-throughput Git operations, Gitaly supports sidechannels - a mechanism for efficient binary data transfer outside of gRPC message framing. Supported Operations:SSHUploadPackWithSidechannel(git fetch)- Other streaming Git operations
- Lower overhead than gRPC message streaming
- Better performance for large data transfers
- Direct byte stream access
Next Steps
Go Client Setup
Learn how to use the Go client library
Ruby Client Setup
Learn how to use the Ruby client library