Skip to content

Using the All-Contributors CLI

All-Contributors Command Line Interface Commands

Section titled “All-Contributors Command Line Interface Commands”

You can run all-contributors init when you first start using the All-Contributors CLI. This command asks a you few questions. It then, sets up the project to support All-Contributors.

The setup includes creating:

  • an .all-contributorsrc configuration file and
  • a contributor table in the files you specify.

The default file for the contributor table is your README.md.

Use the add command to add:

  • new contributors to your project, or
  • add new ways in which they have contributed.

For instance, a user may have already contributed code, but after they add a documentation pull request you might want to add them for documentation too. The contributor will be added to your configuration file, and the contributors file will be updated just as if you used the generate command.

Terminal window
# Add new contributor <username>, who made a contribution of type <contribution>
all-contributors add <username> <contribution>
# Example:
all-contributors add jfmengels code,doc

Where username is the user’s GitHub or Gitlab username, and contribution is a ,-separated list of contributions. See the Emoji Key (Contribution Types Reference) for a list of valid contribution types.

Use check to compare contributors from GitHub with the ones credited in your .all-contributorsrc file, to make sure that credit is given where it’s due.

Use generate to read the contributors list from your .all-contributorsrc file and update the contributor tables specified by the files key.

Please note the command must be able to find the following tags in those files, to update the table:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

Also, note that it needs to find the following tags to update the badge:

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-BADGE:END -->

In some cases you may see the error message GitHub API rate limit exceeded for xxx. You may need to set an environment variable named PRIVATE_TOKEN to circumvent this GitHub rate limit.

Private token is your Personal Access Token (PAT) to authenticate with the GitHub API.

Please note that if you are using a self-hosted GitLab instance, some commands will require you to set an environment variable named PRIVATE_TOKEN first.

Terminal window
# set private token on Linux
export PRIVATE_TOKEN=your_private_token
# set private token on Windows
set PRIVATE_TOKEN=your_private_token