Using VSCode with Git and SSH to Complete/Submit a programming Assignment
Before starting, you should have completed the VScode Setup Guide with SSH. This guide assume you have VScode and SSH capabilities installed, as well as the VSCode extension Remote Development Extension.
Accept the github classroom assignment and follow the link to the repository. For example, if you are working on Lab 1, after accepting the assignment, you’ll have a new repository named
usernameis your github username. My github username is
adamaviv, so you will see that in the screenshots below.
Copy the repository link by clicking the
If you have setup an ssh key, use ssh, otherwise use HTTPS.
To setup an ssh key, see this guide
Open up a new window in VScode via
File->New Windowor ⌘⇧N / Ctrl⇧. Then click the explorer and then
If you don’t see an option to
Clone Repositorythen you may not have
gitinstalled. Follow this link to install it for your computer.
Enter the repo link in the command pallet and confirm the file location you want to cloen the repository to.
You will be prompted where to save the repo. Save it wherever you want, but I like to create a folder called
vscodeto save all my projects.
Go ahead and open the repo in this window by selecting
Once complete, you’ll have your workspace ready to go and integrated terminal open.
Do your work. And once done, you need to commit your work. Start by clicking on the repo symbol
Add the modified files (or new files) to be staged for commit by pressing the
Click the ✓ to perform the commit
Finally, push your changes to github by clicking the
...at the top and selecting push
Finally, finally, you should go back to github as a final check to make sure you pushed all your changes.
Using the git command line in the integrated terminal
You can also use the command line to do the git commands.
git add file.txt #add a file to the commit git commit -m "message" #perform the commit with the commit message git push #push the commit to github
If you want to add all the files that have been modified and commit all at once, use the following
git commit -a -m "message"
Having an issue with ssh?
If you find that your ssh key is not available in the container, you may need to add your private key to the
VScode has a good guide explaining how to help with that
Asking you to set up your git profile?
If you’re getting a error saying you need to setup your name and email, then open the integrated terminal and type these two commands
git config --global user.name "John Doe" git config --global user.email email@example.com
John Doe is replaced with your name and
firstname.lastname@example.org is replaced with the email address you used to sign up to github