๐ฏ Target: create GitHub Repo for multi-collaboration working with code
๐ ๏ธ Tools and prerequisites: Visual Studio Code (VSCode) and sign into GitHub profile
โ Special Requirements: only 2 folders from the local folder needed to be add to GitHub Repo
Step 1 - Creating gitignore-file
As far as I need to add only 2 folders to GitHub Repo from more then 20 other local folders it's better to create gitignore-file and write there some conditions about it.
- Open root folder with folders you need for your repo in VSCode
- Create
gitignore-file
by input into Terminal:
touch .gitignore
So it will appear in root folder.
Step 2 - Edit gitignore-file
Open gitignore-file
and add paths to your folders as shown on the picture below:
# Ignore everything:
*
# Except for:
!folder1/
!folder1/**
!folder2
!folder2/**
Save file.
Step 3 - Create GitHub Repo and push folders into it
- Click the Source Control icon in the Explorer sidebar or press
Ctrl-Shift-G
or click the Source control icon - Click Publish to GitHub, enter repo name and choose if it'll be private or public repo
Once your data be published you will see notification in VSCode, so you can Open on GitHub
button on the link and check it out.
You're done! ๐
Useful resources which I was using making this article:
stackoverflow.com - Using .gitignore to ignore everything but specific directories