Quick start
This walk-through takes a project from nothing to a contributors table with one person in it. It assumes the CLI is installed in your project and that the project is a Git repository with a remote named origin, because init reads that remote to suggest the repository name and owner.
-
Prepare the project
Run
initin the root of your project. The command asks a few questions and offers the repository name and owner from your remote as defaults.npx all-contributors initpnpm all-contributors inityarn all-contributors initA session looks like this:
? What's the name of the repository? all-contributors? Who is the owner of the repository? all-contributors? What is the repository type? GitHub? Where is the repository hosted? Hit Enter if it's on GitHub or GitLab https://github.com? In which file should contributors be listed? README.md? Do you want a badge tallying the number of contributors? Yes? In which file should the badge be shown? README.md? How big should the avatars be? (in px) 100? Do you want this badge to auto-commit when contributors are added? Yes? What commit convention would you want it to use? Angular? Do you want to add a footer with link to usage? YesWhen it finishes, your project has an
.all-contributorsrcfile with your answers, and the file you chose for the contributors contains a badge and a contributors section with the markers that the CLI writes between. -
Add a contributor
Run
addwith a GitHub or GitLab username and the contributions you want to credit.docandcodeare two of the keywords from the emoji key:npx all-contributors add jfmengels doc,codepnpm all-contributors add jfmengels doc,codeyarn all-contributors add jfmengels doc,codeThe CLI looks up the person on the host, adds them to the
contributorslist in.all-contributorsrcand regenerates the table. Since you answered yes to auto-commit in the previous step, it also commits the changed files. -
Look at the result
Open the file you chose for the contributors. The table now contains the person with an avatar, a name and one emoji for each contribution. If you run
generatelater, for example after editing.all-contributorsrcby hand, the CLI rebuilds the table from the list:npx all-contributors generatepnpm all-contributors generateyarn all-contributors generate -
Tell your contributors how it works
Add a short section to your
CONTRIBUTING.mdthat explains how people can ask to be added, and link to this documentation.
Next steps
Section titled “Next steps”- Add contributors covers prompts, several contributions at once and removing a contribution.
- Commit automatically explains the commit options that
initasked about. - Authenticate helps when GitHub reports a rate limit.
