6

I have created an MIT license in Github for my project. It added a license file and now shows up as an MIT license.

I went to Shields.IO and it suggested links to my repo. One of which is the license badge.

I have added this to my read me using markup and all other badges work except the license badge.

I have also allowed shields requests to my Github by it requesting privilleges.

Is there anything else I have to do to get this to work?

I assumed Shields reads Github's license file inside the repo to get the type of license?

lizard
  • 61
  • 1
  • 2
  • It would be useful to report a bug with an example here: https://github.com/badges/shields/issues – Pyves Aug 21 '21 at 17:42

3 Answers3

9

I had the same issue today in one of my repositories. At the end I fixed it by simply overriding the label of the license badge.

Before

before

After

enter image description here

This produces the following url:

https://img.shields.io/github/license/your-name/your-repository?label=license&style=for-the-badge

In my example I'm using the style for-the-badge which is optional of course.

Also make sure, that your repository contains a license file named LICENSE.md with the desired license.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Daniel Bubenheim
  • 4,043
  • 3
  • 14
  • 20
4

I had the same issue - it wasn't recognizing LICENSE or LICENSE.md with an MIT license in it.

For shields.io, I just overrode it for now with

[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)

License

Brian Burns
  • 20,575
  • 8
  • 83
  • 77
1

I also had the same issue, but I found out that if you use capital letters sometimes it doesn't work. For example, instead of:

![GitHub](https://img.shields.io/github/license/user/MyRepository?style=flat-square)

You should use:

![GitHub](https://img.shields.io/github/license/user/myrepository?style=flat-square)
Thend
  • 95
  • 7