1

Bear with me as I'm still trying to figure out how to use Git.

I have connect my GitHub to my VSCode and cloned my repository into my VS workspace.

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.

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.

enter image description here

XinxLax
  • 41
  • 5

1 Answers1

1

From VSCode, you can:

  • open a terminal and 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
  • do git reset yourfolder in order to remove it from the Git index
  • 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

For instance:

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

Repeat the add and status: check the list of files considered by Git is more reasonable.

Then you can commit and push. Using the GitLens extension will add more Git features for you to use.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Hi, thanks for the information. I tried your guide and I have manage to push my folder into my github repo, but I am unable to open up the folder on the github website. The folder I have push into my repo has a folder icon with a right arrow in it. Image shown in my post – XinxLax Jun 30 '21 at 07:48
  • @XinxLax That is because your folder, that you have pushed, has a `.git/` subfolder in it. Repeat the process, but adding your folder *without* that `.git/` subfolder (which would make it a nested git repository). See more at https://stackoverflow.com/a/62057615/6309 – VonC Jun 30 '21 at 07:51
  • yeap I tried deleting both .git files and repeated the process but it still has the same result – XinxLax Jun 30 '21 at 08:03
  • @XinxLax You also need to do a `git rm --cached -- testrig` (*without* trailing `/`: `testrig`, not `testrig/`). Then add, commit and push. – VonC Jun 30 '21 at 08:07