# generate public key using Powershell
# email at the end is just a signature that you created it
ssh-keygen -t rsa -b 4096 -C "olegserdia@gmail.com"
# if you see an error: WARNING: UNPROTECTED PRIVATE KEY FILE!
# then cd to a folder with files and run this in PS:
icacls * /reset /t /c /q # https://superuser.com/questions/106181/equivalent-of-chmod-to-change-file-permissions-in-windows
# start the ssh-agent in the background using GIT
eval "$(ssh-agent)"
# using GIT add private key to SSH agent: (PowerShell does not work for some reason)
# cd to .ssh folder first "cd C:/Users/oserdyuk/.ssh"
ssh-add ~/.ssh id_rsa
# add public key to a GitHub repository: Left top corner--> settings
# Clone repository using GIT
# make sure you are in GIT repository : "cd C:/Users/oserdyuk/Documents/AzureProjects/azure-resume"
git clone git@github.com:Serdia/azure-resume.git
######################################################################
### Push changes to GIT ###
# save what you've done
git add -A
# say what you've done
git commit -m "Deployed storage and bla bla"
# push what you've done
git push
# if a project created in vs code and then need to be pushed to github
git push --set-upstream git@github.com:Serdia/Flask_WeatherApp.git master
######################################################################
# Troubleshooting
# add Private key to ssh agent using PS
ssh-add C:/Users/oserdyuk/.ssh/id_rsa.pub
# or make sure you are in c:/oserdyuk and run
ssh-add .\.ssh\id_rsa
#if error: Error loading key "C:/Users/oserdyuk/.ssh/id_rsa.pub": invalid format
# you can either overrite key in a right format: (it changes email to oserdyuk@oserdyuk-vm - not sure why)
ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub # click Enter to ignore password
git clone git@github.com:ACloudGuru-Resources/acg-project-azure-resume-starter.git
# to remove keys from SSH agent
ssh-add -D
# service OpenSSH Authentification Agent. Make sure it's running.
C:\WINDOWS\System32\OpenSSH\ssh-agent.exe
# start service in powershell
Start-Service -Name "OpenSSH Authentication Agent"
# check if it started
Get-Service ssh-agent
# start the ssh-agent in the background
eval "$(ssh-agent)"
echo "$(ssh-agent)"
# check whether agent is running or not (GIT)
if ps -p $SSH_AGENT_PID > /dev/null
then
echo "ssh-agent is already running"
# Do something knowing the pid exists, i.e. the process with $PID is running
else
eval `ssh-agent -s`
fi
# list all keys that are present in the agent PS or GIT
ssh-add -l
# overwrite the key. Just please enter (to ignore password)
ssh-keygen -f C:/Users/oserdyuk/.ssh/id_rsa.pub
ssh-add -L # copy the key, place it into GitHub. Worked
ssh-add "C:/Users/oserdyuk/.ssh/id_rsa.pub.pub" -- Error loading key. Invalid format
ssh-add ~/.ssh my_id_rsa