To license a project in GitHub, can I do it like this:

There are many files like src->Java, res, etc for my Android app

So I want to use Apache license v 2.0 for open sourcing it

So will the license apply if I use it in the header of one of my files(not all files) will it be open sourced or only that one file is open sourced?


2 Answers 2


It's ambiguous.

If you want to be sure that the entire project is licensed, you should be including a LICENSE file in the root directory of you're repository. In the README, you can make it explicit that the project is licensed under that license.

If you only put the license in a header of one source file, personally I'd assume that only that file is licensed, rather than the entire project.


If you want to retain the license of most files, and add some files licensed differently, you'll first have to find out if new files are in some way derived from the existing ones, in which case the original license decides if you are allowed to license your part differently.

If you are allowed to go ahead, you should then include all LICENSE files that are relevant, and at least add a list of files and licenses or state in each file which license applies. In a README or similar state that several licenses apply, and which ones.

This might be overkill, but better be absolutely clear. It doesn't cost very much to do so, in the end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.