[extensions] hggit= bookmarks= #### $ hg bookmark -r default master #### $ hg push git+ssh://git@github.com:tobyink/some-repo.git #### #!/usr/bin/env perl use v5.14; use constant { GH_USER => 'tobyink', GH_PASS => 'A BIG SECRET', }; use Acme::Constructor::Pythonic qw( Pithub Path::Class::File Path::Class::Dir ); use Cwd; BEGIN { package PithubX::Base; use Pithub::Base (); use Moo::Role; around _request_for => sub { my ($orig, $self, @args) = @_; my $req = $self->$orig(@args); $req->headers->remove_header('Authorization'); $req->headers->authorization_basic(::GH_USER, ::GH_PASS); return $req; }; 'Moo::Role'->apply_roles_to_package( 'Pithub::Base', 'PithubX::Base', ); }; my $gh = Pithub(user => GH_USER, token => 1); my $name = (Dir(cwd)->dir_list)[-1]; while ( not $gh->repos->get(repo => $name)->response->is_success ) { say "creating github repo '$name'"; $gh->repos->create(data => { name => $name, has_wiki => 0, has_downloads => 0, }); } unless (`hg bookmarks` =~ /master/) { say "creating 'master' bookmark"; system "hg bookmark -r default master"; } my $url = sprintf('git+ssh://git@github.com:%s/%s.git', GH_USER, $name); system "hg push $url"; #### [hooks] preoutgoing = /home/tai/bin/github-mirror