Git and SSH - samuel-richardson/Sam-Tech-Journal GitHub Wiki

Git

  • Git is used to maintain a local repository and can be uploaded to sites like github.
  • git clone clones the repository.
  • git pull pulls from repository.
  • git add . adds . to changes
  • git checkout . can undo actions like deletion if they are not committed.
  • git commit to commit changes
  • git push push to a remote repository
  • Authenticate with github using ssh keys or username and tokens which can be set up in github interface.
  • README.md is auto displayed on github.

SSH Keys

  • Below ~ is used to access the users account that will be ssh into.
  • Used to connect remotely without password
  • Make ssh keys with ssh-keygen -t rsa -C "string"
  • public key is saved in ~/.ssh/id_rsa.pub do not move or share private key.
  • To use passwordless ssh add the id_rsa.pub to ~/.ssh/authorized_keys
  • Permissions may need to be altered for this to work
  • chmod 700 ~/.ssh
  • chmod 600 ~./.ssh/authorized_keys
  • chown -R user:user ~/.ssh
  • Disable root login by adding PermitRootLogin no to /etc/ssh/sshd_config

Reflection

  • Github can be used to transfer files and maintain version across scripts.
  • Keyless ssh is useful for quickly accessing other devices as well as uploading to github.
  • Keyless ssh also allows for easy remote control of devices using scripts.