Git Commands
See status:
git status
Add more than one file to the git repo:
git add .
git add *
Commit files to local repo:
git commit -m "message to commit"
Push changes to remote repo:
git push origin master
Create Local Git Repository
Create a folder for the git repository then use the following command to initialise it as a git repo:
git init
GitHub
Once git is installed and repo is cloned set the global username and password to allow automatic push and pull to work:
- git config --global user.name "Your Name"
- git config --global user.email "youremail@yourdomain.com"
Add SSH keys for use with github
generate keys:
ssh-keygen -t ed25519 -C "your_email@example.com"
Add key to ssh agent: start service:
# start the ssh-agent in the background
Get-Service -Name ssh-agent | Set-Service -StartupType Manual
Start-Service ssh-agent
Add SSH key:
ssh-add c:/Users/YOU/.ssh/id_ed25519
Add the public key to github: find the .pub file and add to github: Find key in folder:
gc ssh-add c:/Users/YOU/.ssh/id_ed25519.pub
copy and paste public key into the keys section in github for account/repo
Clone Repo via SSH:
Authenticate via Git Credential Manager:
git credential-manager configure
browse to location to place git repo and run clone command:
#get url for github repo and use git clone command
git clone git@github.com:username/reponame.git