If you are connecting to your github account for the first time, you need to create public / private key on your system and upload the public key it on github.
Run the following command to generate a new key:
ssh-keygen -t ed25519 -C "sanaqvi573@gmail.com"
Add the SSH Key to the SSH Agent
Check if SSH agent is running, if not start the SSH agent:
eval "$(ssh-agent)"
eval "$(ssh-agent -s)"
Add your key to the agent:
ssh-add ~/.ssh/id_ed25519
Add the SSH Key to Your GitHub Account
cat ~/.ssh/id_ed25519.pub
Log in to your GitHub account and navigate to: Settings → SSH and GPG keys → New SSH key.
Paste the key, give it a title (e.g., “My Laptop”), and click Add SSH Key.
ssh -T git@github.com
If ssh -T git@github.com
returns “Host key verification failed,” it means your system is unable to verify GitHub’s server identity. This typically happens due to an issue with the ~/.ssh/known_hosts
file or GitHub’s host key being absent or outdated. Here’s how to fix it:
Manually add GitHub’s official host key to your known_hosts
file.
ssh-keyscan github.com >> ~/.ssh/known_hosts
This will fetch and append GitHub’s host key to your known_hosts
file. To verify that the key has been added, run:
cat ~/.ssh/known_hosts | grep github.com
Log into your github account and create new repository
Now create repository on your local system
mkdir syedtest && cd syedtest
Initialize git with the following command:
git init
Now let’s create file in local git repo so that we can verify after pushing
touch file1
Prepare for staging
git add .
git commit -m "File added"
If this is the first time that you are committing, you will be asked to set user name and email address.
Now add remote repository, copy link from repository created on github
git remote add origin git@github.com:techngi/syedtest.git
git branch -M main
git push -u origin main
The file will be copied to your github repository
Now edit the file on github and download the updated file on your local git
Now create a new branch i.e. dev on your local git and push it to github
git checkout -b dev
Now make some changes and push to github
This update will now show up under dev branch on github and will prompt checker to create pull request
Checker will be able to merge this pull request i.e. update to main branch
Add a Comment