The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Git::Github::Creator - Create a GitHub repository from your local repository

SYNOPSIS

        # edit ~/.github_creator.ini

        # Inside a git repo
        % github_creator --name my-project --desc "an awesome thing"

        # for a Perl distro, figure it out through META.yml
        % github_creator

DESCRIPTION

This is a short script you can run from within an existing git repository to create a remote repo on GitHub using a previously created account. This does not create GitHub accounts (that would violate the GitHub terms of service).

If the --name and --desc switches are not given, it will try to find them in META.yml. If the script doesn't find a META.yml, it tries to run `make metafile` (or `Build distmeta`) to create one.

From META.yml it gets the module name and abstract, which it uses for the GitHub project name and description. It uses the CPAN Search page as the homepage (e.g. http://search.cpan.org/dist/Foo-Bar).

Once it creates the remote repo, it adds a git remote named "origin" (unless you change that in the config), then pushes master to it.

If GitHub sends back the right page, the script ends by printing the private git URL.

METHODS

run( LIST )

Makes the magic happen. LIST is the stuff you'd put on the command line. If you call the module as a script, the run method is called for you automatically.

CONFIGURATION

The configuration file is an INI file named .github_creator.ini which the script looks for in the current directory or your home directory (using the first one it finds).

Example:

        [github]
        login_page="https://github.com/login"
        api-token=123456789023455667890234deadbeef
        account=joe@example.com
        password=foobar
        remote_name=github
        debug=1

Section [github]

login_page (default = https://github.com/login)

This shouldn't change, but what the hell. It's the only URL you need to know.

account (default = GITHUB_USER environment var)

Your account name, which is probably your email address.

api-token

The old GitHub API used an access token, but the new v3 API uses OAuth. Instead of an old access token, you can create an OAuth one by following the example from Net::GitHub:

        my $gh = Net::GitHub::V3->new( login => 'fayland', pass => 'secret' );
        my $oauth = $gh->oauth;
        my $o = $oauth->create_authorization( {
                scopes => ['user', 'public_repo', 'repo', 'gist'], # just ['public_repo']
                note   => 'test purpose',
        } );
        print $o->{token};

If you have a token, you don't need the account or password.

password (default = GITHUB_PASS environment var)
remote_name (default = origin)

I like to use "github" though.

debug (default = 0)

Do everything but don't actually create the GitHub repo.

ISSUES

The GitHub webserver seems to not return the right page every so often, so things might go wrong. Try again a couple times.

Sometimes there is a delay in the availability of your new repo. This script sleeps a couple of seconds then tries to verify that the new repo is there. If it can't see it, look at GitHub first to see if it showed up.

SOURCE AVAILABILITY

This source is part of a GitHub project:

        git://github.com/briandfoy/github_creator.git

AUTHOR

brian d foy, <bdfoy@cpan.org>

David Golden and Ricardo SIGNES contributed to the code.

COPYRIGHT

Copyright (c) 2008-2013, brian d foy, All Rights Reserved.

You may redistribute this under the same terms as Perl itself.