m (1 revision imported) |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Git Commands == | |||
See status:<syntaxhighlight lang="bash"> | |||
git status | |||
</syntaxhighlight>Add more than one file to the git repo:<syntaxhighlight lang="bash"> | |||
git add . | |||
git add * | |||
</syntaxhighlight>Commit files to local repo:<syntaxhighlight lang="bash"> | |||
git commit -m "message to commit" | |||
</syntaxhighlight>Push changes to remote repo:<syntaxhighlight lang="bash"> | |||
git push origin master | |||
</syntaxhighlight> | |||
== Create Local Git Repository == | |||
Create a folder for the git repository then use the following command to initialise it as a git repo:<syntaxhighlight lang="bash"> | |||
git init | |||
</syntaxhighlight> | |||
== GitHub == | == GitHub == | ||
| Line 6: | Line 22: | ||
*git config --global user.name "Your Name" | *git config --global user.name "Your Name" | ||
*git config --global user.email "youremail@yourdomain.com" | *git config --global user.email "youremail@yourdomain.com" | ||
== Add SSH keys for use with github == | |||
generate keys:<syntaxhighlight lang="powershell"> | |||
ssh-keygen -t ed25519 -C "your_email@example.com" | |||
</syntaxhighlight>Add key to ssh agent: | |||
start service:<syntaxhighlight lang="powershell"> | |||
# start the ssh-agent in the background | |||
Get-Service -Name ssh-agent | Set-Service -StartupType Manual | |||
Start-Service ssh-agent | |||
</syntaxhighlight>Add SSH key:<syntaxhighlight lang="powershell"> | |||
ssh-add c:/Users/YOU/.ssh/id_ed25519 | |||
</syntaxhighlight>Add the public key to github: find the .pub file and add to github: | |||
Find key in folder:<syntaxhighlight lang="powershell"> | |||
gc ssh-add c:/Users/YOU/.ssh/id_ed25519.pub | |||
</syntaxhighlight>copy and paste public key into the keys section in github for account/repo | |||
== Clone Repo via SSH: == | |||
Authenticate via Git Credential Manager:<syntaxhighlight lang="powershell"> | |||
git credential-manager configure | |||
</syntaxhighlight>browse to location to place git repo and run clone command:<syntaxhighlight lang="powershell"> | |||
#get url for github repo and use git clone command | |||
git clone git@github.com:username/reponame.git | |||
</syntaxhighlight> | |||
Latest revision as of 19:10, 20 November 2025
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