Because reading code on a website is like reading a menu through a fogged up window. If you want to run tests debug stuff or actually edit code you need the project on your local machine. Cloning a GitHub repository gives you a local copy of the repo so you can use git commands open the project in VS Code and not cry into the terminal.
Follow these steps and you will have a local repo faster than you can say git checkout main. This is the pragmatic approach used by developers who prefer working code over motivational posters.
On the GitHub page click the Code button and copy the URL shown. You will see an HTTPS option and an SSH option. HTTPS is straightforward for one offs. SSH is nicer long term because you will get fewer password prompts.
Use your file manager or run a command like this from your home directory to move into the folder where the repo should live.
cd path to projects folder
Paste the URL into a git clone command. If you like typing less or living dangerously you can add a custom folder name after the URL.
git clone https //github.com user repo.git
or for SSH
git clone git@github.com user repo.git
or to set a custom local folder name
git clone https //github.com user repo.git my local folder
The new folder will match the repository name unless you provided a different folder name. Congratulations you now have a copy of the repo on your local machine.
If you need a branch that is not the default do one of these depending on your mood and efficiency needs.
cd repo
git checkout branch name
git clone -b branch name https //github.com user repo.git
VS Code will detect the project and suggest useful extensions. From your terminal run this to open the folder in VS Code.
code repo
If code is not found add the VS Code command line tools or open the folder from the editor GUI. VS Code will pick up tooling like linters formatters and recommended extensions the way a nosy friend picks up gossip.
Cloning a GitHub repository is a small number of commands that unlock a world of local editing testing and version control. With a reliable workflow you will spend less time wrestling with remotes and more time actually writing code. If you want less friction set up SSH keys and get comfortable with git clone -b and the code command for VS Code. Now go clone something useful and resist the urge to accidentally push a test file named final final final dot txt.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.