Command line tool to bootstrap Github repository
Clone or download
Latest commit 3d5ef45 Jan 14, 2019


Command line tool to bootstrap Github repository.

Donate via Zerocracy DevOps By Managed by Zerocracy

Build Status

PDD status License


This tool automates routine operations when creating new Github repository. It can create and configure Github repository from yaml configuration file. Gitstrap helps to:

  1. Create new repository on Github
  2. Sync with local directory
  3. Apply templates (such as README with badges, CI configs, LICENSE stuff, etc)
  4. Configure webhooks for Github repo
  5. Invite collaborators


Download binary

You can download a binary for your platform using download script:

curl -L | sh

or you can download it manually from releases page.


Use my repo Layman overlay:

sudo layman -o -a g4s8
sudo emerge -av dev-vcs/gitstrap


On macOS you can install it using brew tool:

brew tap g4s8/.tap
brew install g4s8/.tap/gitstrap

Get sources

If you have go installed, you can use go get to download gitstrap tool and build a binary.

Alternatively you can clone it from Github:

git clone --depth=1
cd gitstrap
go build .


Before using, make sure you have running ssh-agent daemon with imported your github ssh key to be able to push, fetch and pull.

To bootstrap new repository:

  1. Create new directory for your project
  2. Write .gitstrap.yaml config in project root
  3. Create Github API token with repo permissions (if doesn't exist)
  4. Run gitstrap -token=your-api-token create

To remove repository (keep source files) run gitstrap -token=your-api-token destroy

To create or destroy a repo for an organization make sure you have permissions to create or delete repositories and use -org=orgname gitstrap option.


The default configuration file is .gitstrap.yaml, you can specify another file with -config=my-config.yaml option.

Each config should include gitstrap key with version v1. gitstrap section must include github section and may include templates and params sections:

    version: v1
            # github repository name
            name: gitstrap
            # github repository description
            description: "Command line tool to bootstrap Github repository"
            # (optional, default false) true if private
            private: false
            # github webhooks
                  # webhook url
                - url: ""
                  # webhook type: form or json
                  type: form
                  # events to send (see github docs)
                      - push
                  # (optional, default true) false to create webhook in inactive state
                  active: true
            # github logins to add as collaborators
                - "rultor"
                - "0pdd"
    # (optional) templates to apply
          # file name in repository
        - name: ""
          # template url
          url: ""
        - name: "LICENSE"
          location: "/home/g4s8/.gitstrap/"
    # (optional) these params can be accessed from template, just a key-value pairs
        rultor: true
        travis: true
        readmeContrib: |
            Fork repository, clone it, make changes,
            push to new branch and submit a pull request.
        pdd: true
        license: MIT


You can create any file templates to apply them using project configuration. Templates can use golang template patterns.


# {{.Repo.Name}}.

{{if .Gitstrap.Params.eoPrinciples }}[![EO principles respected here](]({{end}}
{{if .Gitstrap.Params.rultor}}[![DevOps By]({{.Repo.Owner.Login}}/{{.Repo.Name}})]({{.Repo.Owner.Login}}/{{.Repo.Name}}){{end}}

{{if .Gitstrap.Params.travis}}[![Build Status]({{.Repo.Owner.Login}}/{{.Repo.Name}}.svg?style=flat-square)]({{.Repo.Owner.Login}}/{{.Repo.Name}}){{end}}
{{if .Gitstrap.Params.appveyor}}[![Build status]({{.Gitstrap.Params.appveyor}}?svg=true)]({{.Repo.Owner.Login}}/{{.Repo.Name}}){{end}}
{{if .Gitstrap.Params.pdd}}[![PDD status]({{.Repo.Owner.Login}}/{{.Repo.Name}})]({{.Repo.Owner.Login}}/{{.Repo.Name}}){{end}}
{{if .Gitstrap.Params.license}}[![License]({{.Repo.Owner.Login}}/{{.Repo.Name}}.svg?style=flat-square)]({{.Repo.Owner.Login}}/{{.Repo.Name}}/blob/master/LICENSE){{end}}
{{if .Gitstrap.Params.codecov}}[![Test Coverage]({{.Repo.Owner.Login}}/{{.Repo.Name}}.svg?style=flat-square)]({{.Repo.Owner.Login}}/{{.Repo.Name}}?branch=master){{end}}

this template uses .gitstrap.yaml config and produces

# gitstrap.
Command line tool to bootstrap Github repository

[![DevOps By](](

[![Build Status](](

[![PDD status](](