git section complete

This commit is contained in:
Jacob Delgado 2023-04-02 20:49:20 -07:00
parent 829a960725
commit df93b4f2f8

View File

@ -1,3 +1,53 @@
# The Odin Project # The Odin Project
## How to ask good programming questions ## How to ask good programming questions
- Be very specific and patient
- use screenshots when available
- ask questions directly instead of asking to ask ie. "are there any java experts around?"
## Git
# Set up Git
- Set username and email
```
git config --global user.name "username"
git config --global user.email "email"
```
- If using GitHub, change branch from 'master' to 'main'
```
git config --global init.defaultBranch main
```
- Enable colorful output with git
```
git config --global color.ui auto
```
- Set default branch reconciliation behavior to merging
```
git config --global pull.rebase false
```
- Verify the config
```
git config --get user.name
git config --get user.email
```
# Create an SSH Key for repos
- SSH keys are good for avoiding retyping credentials every time
- Check to see if there is an existing ssh key
```
ls ~/.ssh/id_ed25519.pub
```
- if nothing appears, then there is no key and one needs to be made
- Create ssh key
```
ssh-keygen -t ed25519 -C <youremail>
```
- press enter when asked for what location to store it unless you have a specific location
- add a passphrase and retype it
# Link SSH key to Git
- Find the ssh key input on GitHub or repository website of your choice
- Click on new ssh key and give it a name and leave the window open for the next steps
- Copy the public SSH key
```
cat ~/.ssh/id_ed25519.pub
```
- Paste the key into your settings, it should start with ```ssh-ed25519``` and end with your email
# Testing the Key
- -