Dist::Zilla::Plugin::GitLab::Create - Create a new GitLab repo on dzil new
version 1.0002
Configure git with your GitLab credentials:
$ git config --global gitlab.user LoginName $ git config --global gitlab.token AccessToken
Alternatively you can install Config::Identity and write your credentials in the (optionally GPG-encrypted) ~/.gitlab file as follows:
~/.gitlab
login LoginName token AccessToken
Set up an access token on GitLab, in your profile under "Personal Access Tokens." You must grant the token the api scope!
api
then, in your profile.ini:
# default config [GitLab::Create] # to override publicness [GitLab::Create] public = 0 # use a template for the repository name [GitLab::Create] repo = {{ lc $dist->name }}
See "ATTRIBUTES" for more options.
This Dist::Zilla plugin creates a new git repository on GitLab.com when a new distribution is created with dzil new.
dzil new
It will also add a new git remote pointing to the newly created GitLab repository's private URL. See "ADDING REMOTE" for more info.
issues
Enable issues for the new repository if this option is set to true (default).
merge_requests
Enable merge requests for the new repository if this option is set to true (default).
namespace
Specifies the project namespace path in which to create the repository (by default the repository is created in the user's account).
packages
Enable packages for the new repository if this option is set to true (default).
prompt
Prompt for confirmation before creating a GitLab repository if this option is set to true (default is false).
public
Create a public repository if this option is set to true (default), otherwise create a private repository.
remote
Specifies the git remote name to be added (default 'origin'). This will point to the newly created GitLab repository's private URL. See "ADDING REMOTE" for more info.
repo
Specifies the name of the GitLab repository to be created (by default the name of the dist is used). This can be a template, so something like the following will work:
repo = {{ lc $dist->name }}
snippets
Enable snippets for the new repository if this option is set to true (default).
wiki
Enable the wiki for the new repository if this option is set to true (default).
By default GitLab::Create adds a new git remote pointing to the newly created GitLab repository's private URL if, and only if, a git repository has already been initialized, and if the remote doesn't already exist in that repository.
GitLab::Create
To take full advantage of this feature you should use, along with GitLab::Create, the Dist::Zilla::Plugin::Git::Init plugin, leaving blank its remote option, as follows:
[Git::Init] ; here goes your Git::Init config, remember ; to not set the 'remote' option [GitLab::Create]
You may set your preferred remote name, by setting the remote option of the GitLab::Create plugin, as follows:
[Git::Init] [GitLab::Create] remote = myremote
Remember to put [Git::Init] before [GitLab::Create].
[Git::Init]
[GitLab::Create]
After the new remote is added, the current branch will track it, unless remote tracking for the branch was already set. This may allow one to use the Dist::Zilla::Plugin::Git::Push plugin without the need to do a git push between the dzil new and dzil release. Note though that this will work only when the push.default Git configuration option is set to either upstream or simple (which will be the default in Git 2.0). If you are using an older Git or don't want to change your config, you may want to have a look at Dist::Zilla::Plugin::Git::PushInitial.
git push
dzil release
push.default
upstream
simple
D Ruth Holloway <ruth@hiruthie.me>
This software is copyright (c) 2022 by D Ruth Holloway.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::PluginBundle::GitLab, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::PluginBundle::GitLab
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::PluginBundle::GitLab
For more information on module installation, please visit the detailed CPAN module installation guide.