[英]How to upload only source files to github?
I have project written in python which i would like to upload to my github repo. 我有用python编写的项目,我想上传到我的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. 在笔记本电脑的源目录中,还有其他编译的python脚本(.pyc),我希望避免上传到github。 The documentation avaiable on the internet shows uploading entire source directory to github repo. 互联网上提供的文档显示将整个源目录上传到github repo。
Is there a way to avoid uploading certain file type, specifically *.pyc, to github repo? 有没有办法避免将某些文件类型,特别是* .pyc上传到github repo?
Make a .gitignore
file and add *.pyc
to it 制作.gitignore
文件并向其添加*.pyc
I recommend you put this standard .gitignore for python by github It has *.py[cod]
to get rid of .pyc
, .pyo
and .pyd
files 我建议你把这个标准.gitignore用于python的github它有*.py[cod]
来摆脱.pyc
, .pyo
和.pyd
文件
This is the intent of the .gitignore file 这是.gitignore文件的意图
For your specific problem, you should add *.pyc
to this file. 对于您的特定问题,您应该将*.pyc
添加到此文件中。
When you upload you files to github only what is in your git repo gets uploaded. 当您将文件上传到github时,只会上传git repo中的内容。 pyc files should not have been added to your git repo anyways. pyc文件不应该被添加到你的git repo中。 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. 您可以使用.gitignore文件,不要让pyc文件显示在您的git status
视图中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.