Quick Start
This guide walks you through the most common operations: cloning, staging, committing, and pushing.
Clone a repository
Section titled “Clone a repository”import Gitty
let repo = try await Repository.clone( from: URL(string: "https://github.com/user/repo")!, to: URL(fileURLWithPath: "/path/to/local"), credentials: .token("ghp_yourtoken"))Open an existing repository
Section titled “Open an existing repository”let repo = try Repository.open(at: URL(fileURLWithPath: "/path/to/repo"))Stage and commit
Section titled “Stage and commit”let author = Signature(name: "Alice", email: "alice@example.com")
try repo.stageAll()let commit = try repo.commit(message: "Initial commit", author: author)print(commit.oid.string)Check status
Section titled “Check status”let entries = try repo.status()for entry in entries { print(entry.path, entry.status)}Push to remote
Section titled “Push to remote”try await repo.remotes.push( to: "origin", branch: "main", credentials: .token("ghp_yourtoken"))Next steps
Section titled “Next steps”- Repository guide — open, initialize, clone options
- Credentials guide — token, SSH, username/password
- Branches guide — create, checkout, merge