To add a license to a GitHub repository, click "Add file" on your repo's main page, type "LICENSE" as the filename, and GitHub will offer a "Choose a license template" button. Select MIT (the most common choice), fill in the year and your name, and commit the file. A license tells others what they can and cannot do with your code — without one, your code is technically "all rights reserved."
What Is a License and Why Does It Matter?
A license is a legal document that tells others what they're allowed to do with your code. Without a license, the default under copyright law is "all rights reserved" — meaning no one can legally copy, modify, or use your code, even if it's public on GitHub. This might seem fine until you realize that AI tools like Lovable and V0 generate code using open-source libraries that have their own license requirements. Adding a license to your project clarifies the rules for everyone: contributors, users, and even yourself if you revisit the project years later. The most popular license on GitHub is MIT, which says "do whatever you want with this code, just include the license notice." Other common choices include Apache 2.0 (adds patent protection) and GPL (requires derivative works to also be open-source). For most non-technical founders building with AI tools, MIT is the simplest and safest choice.
Prerequisites
- A GitHub account with a repository you own
- Write permissions on the repository
- A web browser with internet access
Step-by-step guide
Navigate to your repository's main page
Navigate to your repository's main page
Go to github.com and open the repository where you want to add a license. You should see the file list and README on the main page. If the repository was created by an AI tool like Lovable or V0, it likely doesn't have a LICENSE file yet — check the file list to confirm. If you already see a file called LICENSE or LICENSE.md, you already have one and can skip to editing it.
Expected result: You're on the repository's main page and can confirm there is no LICENSE file in the file list.
Click Add file and start creating the license
Click Add file and start creating the license
Above the file list, click the "Add file" dropdown button and select "Create new file." This opens the file editor with an empty filename field at the top. In the filename field, type exactly: LICENSE (all uppercase, no extension). The moment you type this specific filename, GitHub recognizes you're creating a license file and reveals a special button on the right side of the filename field that says "Choose a license template." Click this button.
Expected result: A license template picker appears, showing a list of common open-source licenses.
Select the MIT License template
Select the MIT License template
In the license template picker, you'll see a list of licenses on the left sidebar: MIT, Apache 2.0, GPL 3.0, and others. Click "MIT License" — it's the most widely used license on GitHub and the most permissive. The right side of the screen will show you the full license text with placeholders for the year and your name. MIT essentially says: "You can use, copy, modify, and distribute this code for any purpose, as long as you include this license notice." Read through it briefly to understand what you're agreeing to.
Expected result: The MIT License text appears in the preview with fields for year and copyright holder.
Fill in the year and your name
Fill in the year and your name
In the license template, you'll see two fields to fill in: the year and the copyright holder name. The year defaults to the current year, which is correct for new projects. For the copyright holder, type your full name or your company name. If you're building on behalf of a client or organization, use their name instead. This establishes who owns the copyright — even with an MIT license, you retain copyright; you're just granting broad permissions to others.
Expected result: The year and name fields are filled in, and the license text looks complete.
Review and commit the license file
Review and commit the license file
Click the "Review and submit" button (or "Commit changes" depending on GitHub's current UI). A dialog will appear asking for a commit message. The default message is usually "Create LICENSE" — this is fine, or you can customize it to "Add MIT license." Make sure the option "Commit directly to the main branch" is selected (not "Create a new branch"). Click "Commit changes" to add the license file to your repository. You'll be redirected back to the main page where LICENSE now appears in the file list.
Expected result: The LICENSE file appears in your repository's file list, and a license badge shows up in the right sidebar under About.
Complete working example
1MIT License23Copyright (c) 2026 Your Name45Permission is hereby granted, free of charge, to any person obtaining a copy6of this software and associated documentation files (the "Software"), to deal7in the Software without restriction, including without limitation the rights8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell9copies of the Software, and to permit persons to whom the Software is10furnished to do so, subject to the following conditions:1112The above copyright notice and this permission notice shall be included in all13copies or substantial portions of the Software.1415THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21SOFTWARE.Common mistakes when adding a License to a GitHub Project Using Built-In Templates
Why it's a problem: Typing the filename as "license" (lowercase) or "LICENSE.txt"
How to avoid: Use exactly "LICENSE" (uppercase, no extension) to trigger GitHub's license template picker and enable the license badge in the sidebar.
Why it's a problem: Using GPL for a project that includes proprietary components
How to avoid: GPL requires all derivative works to also be open-source. If your project has proprietary parts or uses closed-source APIs, MIT or Apache 2.0 is safer.
Why it's a problem: Forgetting to add a license to a public repository
How to avoid: Without a license, no one can legally use your code — even if it's public. Add an MIT license if you want others to freely use and build on your work.
Why it's a problem: Adding a license that conflicts with dependencies
How to avoid: Check the licenses of your major dependencies. AI-generated code from tools like Lovable uses MIT-licensed libraries (React, shadcn/ui), so MIT is compatible.
Best practices
- Add a license when you create the repository — it's easier than doing it later
- MIT is the safest default for most personal and commercial projects
- Include the license badge in your README to make it visible at a glance
- If building a commercial product, consult a lawyer before choosing a copyleft license like GPL
- Keep the copyright year updated — some developers use a range like "2024-2026"
- Check that AI-generated code dependencies are compatible with your chosen license
- For private commercial projects, you can skip the license or use a proprietary one
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
Explain the difference between MIT, Apache 2.0, and GPL licenses in simple terms. I'm a non-technical founder building a [type of app] with AI tools. Which license should I choose and why?
Frequently asked questions
Do I need a license for a private repository?
Not strictly, since no one outside your collaborators can see the code. However, adding one clarifies expectations if you ever make the repo public or bring on new team members.
What if I don't add any license?
Without a license, default copyright law applies — "all rights reserved." No one can legally use, copy, or modify your code, even if the repository is public on GitHub.
Can I change the license later?
Yes. You can edit or replace the LICENSE file at any time. However, previous versions of your code remain under the old license for anyone who accessed them before the change.
What license do Lovable and V0 projects use?
AI-generated code from Lovable and V0 uses MIT-licensed dependencies (React, shadcn/ui, Tailwind). Your own project code belongs to you, and you choose the license.
What does MIT license actually allow?
MIT lets anyone use, copy, modify, merge, publish, distribute, sublicense, and sell your code — for any purpose, including commercial — as long as they include the original license notice.
Should I use GPL if I want to keep my code open-source?
GPL requires anyone who modifies and distributes your code to also use GPL. If you want to ensure derivatives stay open-source, GPL works. For maximum flexibility, MIT is more common.
Can RapidDev help me choose the right license for a commercial project?
Yes. RapidDev can advise on license compatibility when your project uses multiple third-party libraries and services, ensuring there are no conflicts.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation