简体   繁体   English

如何将文件添加并推送到 VS 中的克隆存储库

[英]How do I add and push a file into a clone repository in VS

Bear with me as I'm still trying to figure out how to use Git.请耐心等待,因为我仍在尝试弄清楚如何使用 Git。

I have connect my GitHub to my VSCode and cloned my repository into my VS workspace.我已将我的 GitHub 连接到我的 VSCode 并将我的存储库克隆到我的 VS 工作区中。

I have copy and pasted a folder from my desktop into the cloned repository workspace, and I would like to know how I could push and commit the folder into my main repository?我已将一个文件夹从我的桌面复制并粘贴到克隆的存储库工作区中,我想知道如何将该文件夹推送并提交到我的主存储库中?

The folder size was too big to be uploaded into the GitHub web and there is too much file within the folder to be uploaded individual via GitHub web.文件夹太大,无法上传到 GitHub 网站,文件夹中的文件太多,无法通过 GitHub 网站单独上传。

Is there is any tutorial or guide on how I could do so?有没有关于我如何做到这一点的教程或指南?

I have manage to push my folder into my Github Repository, thanks to the proposed guide, but I am unable to open up the folder in the web.由于建议的指南,我已经设法将我的文件夹推送到我的 Github 存储库中,但我无法在网络中打开该文件夹。

在此处输入图片说明

From VSCode, you can:从 VSCode,您可以:

  • open a terminal and git add yourFolder打开终端并 git add yourFolder
  • do git status to see the list of all files added: some might not belong to a Git repository, as they are too big执行 git status 查看添加的所有文件的列表:有些可能不属于 Git 存储库,因为它们太大了
  • do git reset yourfolder in order to remove it from the Git index执行git reset yourfolder以将其从 Git 索引中删除
  • edit a .gitignore file (at the root folder of your cloned repository) in which you can add the files or file extensions that you do not want to add编辑.gitignore文件(在您克隆的存储库的根文件夹中),您可以在其中添加您不想添加的文件或文件扩展名

For instance:例如:

*.exe
*.zip
*.tar
*.tgz

Repeat the add and status: check the list of files considered by Git is more reasonable.重复add和status:查看Git认为的文件列表更合理。

Then you can commit and push .然后你可以提交推送 Using the GitLens extension will add more Git features for you to use.使用GitLens 扩展将添加更多 Git 功能供您使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM