Git Linux SSH Script - tmansfield42/Tech-Journal GitHub Wiki
Git Linux SSH Script
Introduction
In this lab, we set up and used Git, GitHub, and SSH. Outlined here are the steps to install Git on both Linux and Windows, generate personal access tokens on GitHub's developer settings, and use Git commands. We also cloned GitHub repositories, pulled repositories on different computers and lastly created a script to allow for a passwordless SSH login.
Setting Up Git
Installing Git
Ubuntu - apt install git
Centos7 - yum install git
Windows - here
GitHub Configuration
Generating Personal Access Tokens
Go here OR navigate yourself to github.com > Account Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
Generate a token and DO NOT LOSE IT !! (very important)
This will be used as your password when you run the command git push
and are prompted to login.
Git Essentials
Basic Git Commands
git add .
- adds what you have currently into what WILL be committed then pushed to github
git config user.email
- add your github email here
git config user.name
- add your github username here. For me that was tmansfield42
git commit -m "input message here"
- commits what you added to github with a message, basically gets it ready to be pushed onto official github
git push
- You will be prompted to login here. Use the generated token from previous steps. This finalizes the git commit command.
git clone https://github.com/YourRepoHere/
- clones a github repository to your computer.
git pull
pulls any new edits to the repository that you have cloned
SSH
Generating RSA Key Pair
ssh-keygen -t rsa -C "sys265"
no password
creating passwordless user
- Copy my secure-ssh.sh bash script
you run this by typing sudo bash secure-ssh.sh