sundar_ima
sundar_ima

Reputation: 3910

How to upload only source files to github?

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?

Upvotes: 2

Views: 3137

Answers (3)

Deelaka
Deelaka

Reputation: 13723

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

Upvotes: 8

RedX
RedX

Reputation: 15185

When you upload you files to github only what is in your git repo gets uploaded. pyc files should not have been added to your git repo anyways. If you did, remove them before pushing your repository.

You can use the .gitignore files to not let pyc files show up in your git status view.

Upvotes: 1

user2245644
user2245644

Reputation: 387

This is the intent of the .gitignore file

For your specific problem, you should add *.pyc to this file.

Upvotes: 1

Related Questions