Add Default Files to New Repositories

This listener adds a default list of files to new repositories where the condition matches. This is useful when there are files you want to add to all repositories, such as licensing files or gitignores.

To add one of these listeners, follow these steps:

  1. Navigate to Admin > Listeners > Create Listener.
  2. Select Add default files to new repositories.
  3. Add a Name to describe the listener.
  4. Select what Projects/Repositories you want the default files to apply to.
  5. Add Conditions for the listener by writing code on the Script tab or uploading existing code on the File tab. You also have the option to click Example Scripts and copy code from a selection of relevant script examples. 
  6. Enter the path of a default file, using '/' as a delimiter, and click Add File.
  7. Enter the content of the new file into the text editor that appears below.
  8. Repeat this for each default file you wish to add. You can click Delete File to remove a file you accidentally added.
  9. Click Add at the bottom of the page once all default files have been added.

All files added in a listener will be added to new repositories in a single commit. If more than one listener matches the condition, a commit will be added for each listener run. Please bear in mind that listeners will not necessarily run in the same order every time. This means that if multiple listeners create the same file, you cannot predict which version will be the most recent.