There are only two ways you can use copyrighted materials that you did not create.
- You have a license to use the material, usually by paying for it.
- The specific copyright license on the material allows you to use it, for instance Creative Commons or others.
If you meet these requirements you still need to be careful about including the material in your code repository.