Mastering Git: A Beginner's Guide to Uploading Projects via VSCode to GitHub in 2024 (MacOS)
Step-by-step instructions for pushing commits to your remote repository
Setup Git and VSCode: Install Git and VSCode via Homebrew, and Sign up for a GitHub account.
Generate an SSH key: Ensure your device can access your GitHub account to push code to a remote directory.
Start the ssh-agent in the background.
eval "$(ssh-agent -s)"
open ~/.ssh/config
If the file doesn't exist, create the file by
touch ~/.ssh/config
then,
open ~/.ssh/config
paste this in the config file:Host github.com AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/id_ed25519
Secure your SSH key and save your passphrase:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Adding generated SSH in your GitHub account: Use SSH key for authentication or commit signing, or both. Upload the key twice if needed.
Copy the SSH public key
pbcopy < ~/.ssh/id_
ed25519.pub
Go to your GitHub account in the web browser.
On the right-top corner,
click
profile picture > Settings > SSH and GPG keys
Click 'Add new key',
Title: MacSetup(put anything),
Key Type: Authentication Key
Key: Paste the clipboard
Set up Git Configurations: Set up your environment to upload code under your GitHub profile name.
git config --global
user.name
"Your GitHub Username"
git config --global
user.email
"
your.email@example.com
"
Create a Repository in GitHub, clone it into your local device and start:
Copy the SSH version of your repository.
Create a folder in local machine, open it in terminal,
run
git clone
git@github.com
:"YourGitHubUsername"/"YourRepo".git
open that folder in VSCode and enjoy Pushing onto the remote.
Test Your Setup: Perform a test commit and push to confirm functionality. Check GitHub for successful commits.
Basic Git Commands to test it: start by
git init
Create or modify any file, then run
git commit -am "Your commit message"
To push the code,
git push
Check the Web browser for commit history.
All The Best !!