What’s new for 2022?
- New-and-improved lectures (hopefully!), filmed once again in Sanders Theater, though with masks on, for health’s sake!
- Lectures are now available in 4K HDR, which means they should look even better (hopefully!) on HDR monitors and TVs!
- New lectures on Cybersecurity and Emoji!
- Instead of CS50 IDE, CS50x 2022 uses a web-based version of VS Code, a popular text editor, available at code.cs50.io, which you’ll learn about in Week 1.
- A new mystery to solve in Fiftyville using SQL!
All this and more!
Did you start CS50x in 2021 or earlier?
Welcome back! Instead of CS50 IDE, CS50x 2022 uses a cloud-based version of Visual Studio Code (VS Code) at code.cs50.io, which provides you with your very own “codespace” (i.e., workspace) for CS50.
How to log into your codespace
Visit code.cs50.io. Ignore any buttons that mention “VS Code Desktop.”
Configure Git to use SSH in your CS50 Codespace
- Open a terminal window, if not open already, within your CS50 Codespace.
ssh-keygen. When prompted to “save the key,” just hit Enter, without typing anything.
- You’ll then be prompted for a “passphrase” (i.e., password). If you only use your GitHub account for CS50, no need to input a passphrase; just hit Enter. Otherwise, input a passphrase (that you won’t forget!), then hit Enter, then input it again, then hit Enter again. For security’s sake, you won’t see what you type. You’ll then see a “randomart image” that you can ignore.
cat ~/.ssh/id_rsa.pub. You’ll then see your “public key,” multiple lines of seemingly random text. Highlight and copy all of those lines, from
ssh-rsato the end. But don’t highlight your terminal window’s prompts (which contain
$) before or after those lines.
- Visit https://github.com/settings/keys, logging in with your GitHub username and password as usual. Don’t use the passphrase you just created, if any.
- Click New SSH Key.
- Paste your public key into the text box under Key. Optionally input a title under Title (e.g.,
CS50 VS Code).
- Click Add SSH Key.
ssh -T firstname.lastname@example.org -p 443. You should be greeted with
“Hi USERNAME! You’ve successfully authenticated, but GitHub does not provide shell access.”If you don’t see that, review the above steps to verify you didn’t skip something.
You should now be able to use
git) without GitHub username and password. But if you created a passphrase, you might still be prompted for that.
How to copy files from CS50 IDE to your CS50 Codespace
Download files from CS50 IDE
In your CS50 IDE terminal run the following command to change terminal location to your home directory
Then run the following command to create a folder named “migration”
Move the files and folders you want to copy over to VS Code to that folder you just created. You move files and folders via the GUI in the file tree on the left-hand-side of your CS50 IDE, or use the
mv command if comfortable with command-line.
Then, right-click the folder “migration” and click “Download” to download the folder as a zip file to your computer.
Depending on the files sizes and your internet connection speed, the downloading process might take a few minutes or more.
Upload files to your codespace
In your codespace terminal (in the browser), run the following command to change terminal location to your home directory
Then, right-click anywhere in the “Explorer” sidebar on your left-hand side and click “Upload…”, a file dialog will be prompted for you to choose the files you want to upload. Choose the zip file “migration.zip” you have just downloaded from CS50 IDE and upload it to your codespace.
Depending on the zip file size and your internet connection speed, the uploading process might take a few minutes or more.
Once the upload process is complete, run the following command to unzip the zip file
Your files downloaded from CS50 IDE should be in the “migration” folder, and you can execute the below to view the files you have just migrated from CS50 IDE to your codespace
How to use VS Code Desktop
If you are already familiar with VSCode and have it installed on your own computer, you can open your codespace in VS Code on your desktop. This does not download your files to your computer, but instead will launch a remote connection so you can access your codespace directly in VSCode rather than in a separate browser. This is entirely optional. You are not required to install VS Code to complete CS50x.