[英]How to add python files to a new repository in github
I am trying to learn and understand basics of github.我正在尝试学习和理解 github 的基础知识。 For the purpose, I created some files.
为此,我创建了一些文件。
Now, I had created a repository earlier with name try-catch-basics, and included the first file in it.现在,我之前创建了一个名为 try-catch-basics 的存储库,并将第一个文件包含在其中。 I wanted to include my second and third files in the new repository that I created, but I am not able to do that.
我想将我的第二个和第三个文件包含在我创建的新存储库中,但我无法做到这一点。 Here are the steps that I followed for the same -
以下是我遵循的相同步骤 -
View -> Command Palette -> Git: Add Remote ->https://github.com/SteelTitan247/File-handling-in-python -> Gave a name -> and pressed enter.查看 -> 命令面板 -> Git:添加远程 -> https://github.com/SteelTitan247/File-handling-in-python -> 命名 -> 然后按回车键。
Then, I clicked source control and commited with a message.然后,我单击源代码管理并提交了一条消息。 Now, an option is showing me for sync changes.
现在,一个选项正在向我显示同步更改。
When I am clicking on it, it is showing me this -当我点击它时,它向我展示了这个 -
which is the previously created repo for my file 1. How do I "shift" or change repo from this to my new one?这是我的文件 1 之前创建的回购协议。如何将回购协议“转移”或更改为我的新回购协议?
For reference, this is the older repo - https://github.com/SteelTitan247/try-catch-basics作为参考,这是较旧的回购 - https://github.com/SteelTitan247/try-catch-basics
And this is the one in which I want to push my new files - https://github.com/SteelTitan247/File-handling-in-python这是我要推送新文件的文件 - https://github.com/SteelTitan247/File-handling-in-python
Please correct my mistakes and guide me through it.请纠正我的错误并指导我完成它。
New repository you got page like this.新的存储库你得到这样的页面。
Click on upload existing files and drop your files in next window单击上传现有文件并将文件拖放到下一个窗口中
Enter your commit message and click on commit changes输入您的提交消息并单击提交更改
Now you have files in your repository!现在你的存储库中有文件了! now clone your repository from vs code and start working with git
现在从 vs code 克隆你的存储库并开始使用 git
I usually use the GitHub application itself, in it, to upload my files to another repository, I would first have to sync the repository and then move or copy the files to the chosen folder.我通常使用 GitHub 应用程序本身,在其中将我的文件上传到另一个存储库,我首先必须同步存储库,然后将文件移动或复制到所选文件夹。 After that perform the commit and pull
之后执行提交和拉取
You can use source tree tool and clone git repo in your project and than you can add/[commit,push] your files您可以在您的项目中使用源代码树工具和克隆 git repo,然后您可以添加/[提交,推送] 您的文件
You can drag and drop files manually for very first time in main branch and than clone your repository in new location and than ready to go!您可以第一次在主分支中手动拖放文件,然后在新位置克隆您的存储库,然后就可以开始了!
In vs code first clone your repository and than push your files.在 vs 代码中,首先克隆您的存储库,然后推送您的文件。 Open your local project.
打开您的本地项目。
3.1 VSCode source control interface showing Open Folder and CLone Repository 3.1 显示打开文件夹和克隆存储库的 VSCode 源代码控制界面
3.2 Add a README.md file (If you don't have anything else to add yet) 3.2 添加一个 README.md 文件(如果你还没有其他东西要添加的话)
3.3 VSCode explorer interface showing README.md 3.3 VSCode 浏览器界面显示 README.md
3.4 Click on Publish on Github 3.4 点击发布到Github
3.5 VSCode source control interface showing Initialize Repository and Clone to GitHub 3.5 VSCode 源代码控制界面显示 Initialize Repository 和 Clone to GitHub
3.6 Choose whether you want your repo to be private or public 3.6 选择你的回购是私人的还是公共的
3.7 Interface showing choice between private and public repos 3.7 显示私人和公共回购之间选择的界面
3.6 Choose the files you want to include in first commit. 3.6 选择要包含在第一次提交中的文件。
Note: If you don't select a file or folder it will added to.gitignore file注意:如果您不选择文件或文件夹,它将添加到 .gitignore 文件
Showing interface where you choose which files to include in the repo显示您选择要包含在回购中的文件的界面
You are good to go.你已准备好出发。 it is published.
它已发布。
PS If this was your first time a prompt will ask for for your Github Credentials. PS 如果这是您第一次使用,系统会提示您提供 Github 凭据。 Fill those in and you are good to go.
填写这些内容,您就可以开始了。 It is published.
它已发布。
For more Information: How to add a new project to Github using VS Code更多信息: 如何使用 VS Code 将新项目添加到 Github
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.