How to upload only source files to github?

git, github, python

Solution

Make a `.gitignore` file and add `*.pyc` to it

I recommend you put this standard .gitignore for python by github It has `*.py[cod]` to get rid of `.pyc`,`.pyo` and `.pyd` files

Problem

I have project written in python which i would like to upload to my github repo. In my source directory in laptop, there are other compiled python scripts (.pyc) residing as well which i would like to avoid uploading to github. The documentation avaiable on the internet shows uploading entire source directory to github repo. Is there a way to avoid uploading certain file type, specifically *.pyc, to github repo?

Original source