Git
Git Commands
See status:
| |
Add more than one file to the git repo:
| |
Commit files to local repo:
| |
Push changes to remote repo:
| |
Create Local Git Repository
Create a folder for the git repository then use the following command to initialise it as a git repo:
| |
connect to remote repo:
| |
verifiy the repo with:
| |
if the remore repo already exists and you want to replace it:
| |
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 “your email - try to use the one generated by github to shield your own email from commits”
install github cli:
| |
login to github:
| |
create repo from current folder:
| |
Add SSH keys for use with github
generate keys:
| |
Add key to ssh agent:
start service:
| |
Add SSH key:
| |
Add the public key to github: find the .pub file and add to github:
Find key in folder:
| |
copy and paste public key into the keys section in github for account/repo
Clone Repo via SSH:
Authenticate via Git Credential Manager:
| |
browse to location to place git repo and run clone command:
| |
##Use SSH keys and point each repo to an SSH remote.
1) Create SSH key(s) (Windows PowerShell)
For one account:
| |
Press Enter for default path (~/.ssh/id_ed25519).
For two accounts (recommended: separate keys):
| |
2) Start agent and add keys
| |
(If one account, add that single key.)
3) Add public keys to GitHub
Show public key:
| |
Copy each key into GitHub:
- GitHub > Settings > SSH and GPG keys > New SSH key
4) Create ~/.ssh/config
| |
5) Set repo remotes to the right host alias
Personal repo:
| |
Work repo:
| |
Check:
| |
6) Test auth
| |