NAME

Git::Native::Credential - A libgit2 credential (passed back from acquire callbacks)

VERSION

version 0.003

SYNOPSIS

use Git::Native::Credential;

my $cred = Git::Native::Credential->userpass(
  username => 'git',
  password => $ENV{GITHUB_TOKEN},
);

# ssh-agent (matches CLI default for git+ssh remotes)
my $cred = Git::Native::Credential->ssh_agent(username => 'git');

# explicit key file
my $cred = Git::Native::Credential->ssh_key(
  username    => 'git',
  public_key  => "$ENV{HOME}/.ssh/id_ed25519.pub",
  private_key => "$ENV{HOME}/.ssh/id_ed25519",
  passphrase  => '',
);

DESCRIPTION

Returned from the credentials callback you pass to Git::Native::Remote's fetch/push. libgit2 takes ownership of the credential once the callback returns successfully — the Perl wrapper is disowned automatically so it won't double-free.

If you construct one without passing it to libgit2, DEMOLISH calls git_credential_free for you.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-git-native/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.