We won’t use CMake, so disable CMake and CMake tools in the local extensions.īuild Tasks and Debugging Setup Build Tasksīuild tasks are roughly equivalent to the make files that we use in class (e.g./mk). Go back to the extensions tab, scroll down until you see C/C++ Extension Pack and then click “Install in WSL: Ubuntu”. After VS Code comes up, you should see the text “WSL: Ubuntu” in the bottom left corner. If it is working properly, you should see similar output:Īlmost done with the WSL setup, now we just need to install the WSL Extensions inside of the WSL VM. Now cd into the repo you cloned and run the following command to open VS Code. Mkdir dev # You should probably know what these commands do by now :)Īnd run the following command with the link you just copied. cd ~ # CD to home directory (/home/username is equivalent to ~) You probably don’t want to clone repos into your home folder in the terminal, so run the following commands to make a dev folder in your home directory. (If you need to clone a repo for a lab or something, go to the repository in Github and click “Code” in the top right, then SSH, then copy that link. Next, hop over into the terminal and navigate to a repo you have cloned. (It should have 9 extensions included, not just the C/C++ extension). In VS Code, click Extensions on the left hand navigation bar, then type in C/C++ Extension Pack to install the necessary extensions. After it is installed and open, close & reopen the terminal to make sure the PATH environment variable is updated to include VS Code. Install VS Code for Windows (don’t install it in the terminal). Now, you should be able to clone, push & pull from Github without a password. Go to the terminal now and run the following commands to configure git: git config -global user.email config -global user.name "Firstname Lastname" Paste the key into the Key field and click “Add SSH Key”. Name it something descriptive, like “Dell Laptop” or something that ties it to your machine. Pop over to GitHub and navigate to Settings->SSH & GPG Keys. Never share this file with anyone, it is basically your password.Ĭopy the entire output (including ssh-rsa) to your clipboard. There is also a id_rsa in this folder that contains your private key. Run the following command to print your public key to stdout: cat ~/.ssh/id_rsa.pub Home stretch, now need to add the SSH key to GitHub. Next, run the following commands to register the ssh key: eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa The output should look like this (if you want the fancy tabbed terminal, install Terminal from MS Store) In the terminal, generate a ssh key by using the following command (replace your email first): ssh-keygen -t rsa -b 4096 -C will need to press enter to save in the default location, and don’t put in a password unless you want to type it in all the time (an extra layer of security if you want it). Therefore, we gotta have SSH keys to git gud. Next, it will be helpful if we didn’t have to type in a token or a password each time we want to pull or push to our Git remotes. sudo apt install git git-extras build-essential gcc-multilib gdb cmake -y Installing Necessary Development PackagesĪfter we get a terminal open, run the following commands to update Ubuntu package information and upgrade all installed software: sudo apt update & sudo apt upgrade -yĪfter this completes, run the following command to install git, the gcc toolchain, gdb, and cmake. You will need this password to run sudo and other privileged commands in WSL. After this completes, you will need to type in a username and password for your WSL virtual machine. After that has finished installing, in PowerShell, type the Restart-Computer cmdlet to restart and finish installing WSL2.Ī terminal should open on restart with the text Installing, this may take a few minutes. Next, run the command wsl -install to quickly install everything needed to run Ubuntu on Windows. Right-click the start menu icon and click “Windows PowerShell (Administrator)” or use the Win-X + A shortcut to do the same thing. Pushing Changes Back to GitHub Installing WSLįirst off we want to pop into PowerShell to get WSL2 installed on the Windows machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |