Live in the future, then build what's missing!

github start

maker /
categories | tool 
tags | git  github 

I want to try git and github.

1. set up git

  1. Sets the default name for git to use when you commit

git config —global user.name “Your Name Here”

  1. Sets the default email for git to use when you commit

git config —global user.email “your_email@youremail.com”

2. password

a: Check for SSH keys

cd ~/.ssh

  1. Checks to see if there is a directory named “.ssh” in your user directory

b: Backup and remove existing SSH keys

ls

  1. Lists all the subdirectories in the current directory
  2. config id_rsa id_rsa.pub known_hosts

mkdir key_backup

  1. Makes a subdirectory called “key_backup” in the current directory

cp id_rsa* key_backup

  1. Copies the id_rsa keypair into key_backup

rm id_rsa*

  1. Deletes the id_rsa keypair

c: Generate a new SSH key

ssh-keygen -t rsa -C “your_email@youremail.com”

  1. Creates a new ssh key using the provided email
  2. Generating public/private rsa key pair.
  3. Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]
    Enter passphrase (empty for no passphrase): [Type a passphrase]
  4. Enter same passphrase again: [Type passphrase again]
    Your identification has been saved in /c/Users/you/.ssh/id_rsa.
  5. Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub.
  6. The key fingerprint is:
  7. 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@youremail.com
    d: Add your SSH key to GitHub

clip < ~/.ssh/id_rsa.pub

  1. Copies the contents of the id_rsa.pub file to your clipboard

Go to your Account Settings

Click “SSH Keys” in the left sidebar

Click “Add SSH key”

Paste your key into the “Key” field

Click “Add key”

Confirm the action by entering your GitHub password

e: Test everything out

ssh -T git@github.com

  1. Attempts to ssh to github

2. create a repo

a: Create the README file

mkdir ~/Hello-World

  1. Creates a directory for your project called “Hello-World” in your user directory

cd ~/Hello-World

  1. Changes the current working directory to your newly created directory

git init

  1. Sets up the necessary Git files
  2. Initialized empty Git repository in /Users/you/Hello-World/.git/

touch README

  1. Creates a file called “README” in your Hello-World directory

b: Commit your README

git add README

  1. Stages your README file, adding it to the list of files to be committed

git commit -m ‘first commit’

  1. Commits your files, adding the message “first commit”

c: Push your commit

git remote add origin https://github.com/username/Hello-World.git

  1. Creates a remote named “origin” pointing at your GitHub repo

git push origin master

  1. Sends your commits in the “master” branch to GitHub

3. fork a repo

  1. Clones your fork of the repo into the current directory in terminal

git clone https://github.com/username/Spoon-Knife.git

4. don’t input username everytime

#ssh

git remote rm origin

git remote add origin git@github.com:username/projectname


Previous     Next