DB-hub Technology DevOPS Github SSH Key

Github SSH Key

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

And I create a project on another computer yesterday. I created a pair of ssh to use them to push work to github account. I change to this computer and create a project MLE. I am prepared to push the work to the same github account, but a new project MLE. I can still use the same ssh key, on remote github already saved the public key. I only need copy the private key to this computer.
Step 1 install git on this computer download from official site. Installed at C:\Users\user\Git
Step 2 copy the folder .ssh from another computer, and saved at C:\Users\user.ssh
Step3 in windows powershell administrator, run ssh agent in background

start the ssh-agent in the background

Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
Get-Service -Name ssh-agent #make sure ssh-agent is running
Step4 Add private sshkey to ssh-agent
In cmd window, run
ssh-add c:/Users/lilyw/.ssh/id_ed25519
Step5 Add the SSH public key to your account on GitHub. #Yesterday already done
Go to account main page,top right corner ,left click profile pic, choose setting, add SSH public key there.

Next coming steps is just push local MLE project folder to github

1 Go to github, create new repository MLE. Empty
2 git remote add origin git@github.com:githubusername/MLE.git
git remote –v #confirm remote are set
origin git@github.com:githubusername/MLE.git (fetch)
origin git@github.com:githubusername/MLE.git (push)
2 cmd cd local MLE
3 git init
4 git remote set-url origin git@github.com:githubusername/MLE.git
5 git pull origin main # if github repo is empty, there is no “main” branch yet, so this command will fail, this step can be skipped.
6git add .
7 Git commit –m “initial commit” #error, fatal: unable to auto-detect email address (got ‘user@gmail.(none)’)
8 git config –global user.name “githubusername” #fix
git config –global user.email user@gmail.com
9 Git commit –m “initial commit” #pass
10 git push -u origin main #error, src refspec main does not match any
11 git branch # Check your branch name
Master #my branch is master , not main. So fix it
12 git push -u origin master #push successful