简体   繁体   English

如何只将源文件上传到github?

[英]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.

相关问题 如何从Colab上传大文件到GitHub? - How to upload large files from Colab to GitHub? 如何在不使用 Google Drive 的情况下从 Github 将文件上传到 Colab? - How to upload files to Colab from Github without using Google Drive? 如何只将文件上传到谷歌驱动器一次? - How to upload the files to google drive only once? Python - 使用PyGithub直接上传文件到github - Python - Upload files directly to github using PyGithub 仅当源比Python中的目标更新时,如何复制文件? - How to copy files only if the source is newer than the destination in Python? 如何仅使用在django模型中过滤的少数模型将文件上传到AWS? - How upload files to AWS only with a few models filtered in django models? 如何使用 boto3 将 Github 上的文件上传到 AWS S3 存储桶? - How can I upload the files on Github to AWS S3 bucket using boto3? 如何使用python请求将tar.gz和jar文件上传为GitHub资产? - How to upload tar.gz and jar files as GitHub assets using python requests? 如何在Django中上传文件? - How to upload files in Django? 如何使用 PyGithub 将图像文件上传到 Github? - How to upload an image file to Github using PyGithub?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM