How to add customized .gitignore, LICENSE and README


#1

Important Notes

  • This post is based on Gogs 0.9.74.0811.

It is very easy to add your own .gitignore, LICENSE and README files/templates to your Gogs instance without touching a single bit of Git history. All magic happens under your custom directory. Yes, the same parent directory of your custom/conf/app.ini.

Adding .gitignore

If you don’t find any of existing .gitignore template satisfy your needs, create a new one by yourself or download combined templates from https://www.gitignore.io/, then give it a name, let’s say My Gitignore (without any extensions).

After that, move this file to custom/conf/gitignore/My Gitignore and restart Gogs, you should be able to see the My Gitignore is now in the list of .gitignore templates.

Adding LICENSE

It is basically the same approach to add your own LICENSE files, make it and give it a name, then move to directory custom/conf/license and restart Gogs.

Adding README

Create a plain text file then move to directory custom/conf/readme and restart Gogs.

However, README template supports four basic placeholders to feel like it is advanced:

# repo name is: {Name}

{Description}

You can get the development version of this repo via `git clone {CloneURL.SSH}` or `git clone {CloneURL.HTTPS}`

This is how it looks like in action:


:speech_balloon: Please leave comments if you have any questions or concerns about this post.


How to use predefined label templates