NAME

Git::Native::Remote - A libgit2 remote (fetch / push)

VERSION

version 0.003

SYNOPSIS

my $remote = $repo->remote('origin');
say $remote->url;

$remote->fetch(
  refspecs    => ['+refs/heads/*:refs/remotes/origin/*'],
  credentials => sub {
    my (%args) = @_;
    Git::Native::Credential->ssh_agent(
      username => $args{username_from_url} // 'git',
    );
  },
  prune => 1,
);

$remote->push(
  refspecs    => ['+refs/karr/*:refs/karr/*'],
  credentials => sub {
    Git::Native::Credential->userpass(
      username => 'git',
      password => $ENV{GITHUB_TOKEN},
    );
  },
);

DESCRIPTION

Wraps git_remote*. Supports the libgit2 credential acquire callback, so SSH-agent / SSH-key / HTTPS-token auth all work without shelling out to the git binary.

The credentials coderef is invoked by libgit2 each time an auth attempt is needed. It receives url, username_from_url, and allowed_types as named args, and must return either a Git::Native::Credential or undef (to fall through to the next auth type).

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.