Alessandro Ghedini > Git-Raw-0.24 > Git::Raw::Remote



Annotate this POD


View/Report Bugs
Module Version: 0.24   Source   Latest Release: Git-Raw-0.33


Git::Raw::Remote - Git remote class


version 0.24


    use Git::Raw;

    # open the Git repository at $path
    my $repo = Git::Raw::Repository -> open($path);

    # add a new remote
    my $remote = Git::Raw::Remote -> create($repo, 'origin', $url);

    # set the acquire credentials callback
    $remote -> cred_acquire(sub { Git::Raw::Cred -> plaintext($usr, $pwd) });

    # connect the remote
    $remote -> connect('fetch');

    # fetch from the remote and update the local tips
    $remote -> download;
    $remote -> update_tips;

    # disconnect
    $remote -> disconnect;


A Git::Raw::Remote represents a Git remote.

WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).


create( $repo, $name, $url )

Create a remote with the default fetch refspec and add it to the repository's configuration.

name( [ $name ] )

Retrieve the name of the remote. If $name is passed, the remote's name will be updated and returned.

url( [ $url ] )

Retrieve the URL of the remote. If $url is passed, the remote's URL will be updated and returned.

fetchspec( [ $spec ] )

Retrieve the fetchspec of the remote. If $spec is passed, the remote's fetchspec will be updated and returned.

pushspec( [ $spec ] )

Retrieve the pushspec of the remote. If $spec is passed, the remote's pushspec will be updated and returned.

cred_acquire( $callback )

Run $callback any time authentication is required to connect to the remote repository. The callback receives a string containing the URL of the remote, and it must return a Git::Raw::Cred object.

connect( $direction )

Connect to the remote. The direction can be either "fetch" or "push".

disconnect( )

Disconnect the remote.

download( )

Download the remote packfile.

save( )

Save the remote to its repository's config.

update_tips( )

Update the tips to the new status.

is_connected( )

Check if the remote is connected.


Alessandro Ghedini <>


Copyright 2012 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: