Credentials
Gitty’s Credentials enum covers all common authentication methods. Pass credentials to clone, fetch, and push.
Personal Access Token (recommended for GitHub/GitLab)
Section titled “Personal Access Token (recommended for GitHub/GitLab)”let creds = Credentials.token("ghp_yourpersonalaccesstoken")Username & Password
Section titled “Username & Password”let creds = Credentials.usernamePassword( username: "alice", password: "hunter2")SSH Agent
Section titled “SSH Agent”Delegates to the system SSH agent (ssh-agent). The agent must be running and have the key loaded.
let creds = Credentials.sshAgentDefault (credential helper)
Section titled “Default (credential helper)”Falls back to the system Git credential helper (macOS Keychain, etc.):
let creds = Credentials.defaultUsage example
Section titled “Usage example”try await repo.remotes.fetch( remote: "origin", credentials: .token("ghp_yourtoken"))
let repo = try await Repository.clone( from: URL(string: "https://github.com/user/private")!, to: localURL, credentials: .usernamePassword(username: "alice", password: "secret"))