Creating a Repository
Generating a Token
- Watch this video if your
commitorpushfailed!
Generating an ssh Key
- Execute the commands below if the command above failed AND you’re prompted for a fingerprint!
#!/bin/bash
# replace $1 with your github username
username=$1
# replace $2 with your github email
email=$2
# reset git config
git config --system --unset credential.helper
# set git config
git config --global user.name $username
git config --global user.email $email
# generate ssh-key used for authentication
ssh-keygen -t rsa -m PEM -C $email
# copy ssh-key to clipboard
clip < ~/.ssh/ida_rsa.pub
pcbopy < ~/.ssh/ida_rsa.pub
echo navigate to https://github.com/settings/keys and paste the contents of your clipboard
Create a Remote Repository
- Navigate to
github.com/new - click “new” button at the top right of browser
Creating a Local Repository and Pushing to Remote Repository
- Navigate to the root folder of the project you would like to become a repository.
git init- this generates a
.gitfolder in this directory. - the
.gittells this directory that it is a git-repository, enabling subsequentgitcommands in this directory.
- this generates a
git add .- adds all changes in this directory to the repository
- this modifies the contents of the aforementioned
.gitfolder
git commit -m 'my update message'- commits these changes to be pushed onto the web
- this modifies the contents of the aforementioned
.gitfolder
git push -u origin master- pushes the committed changes onto the web, making them accessible through the web.
- the local
.gitis compared to the remote.git, and respective changes are written as a new commit
Cloning a Preexisting Project
- From a browser, navigate to the URL of the GitHub repository you would like to clone.
- Copy the URL of the repository your clipoboard.
- From a terminal, do the following:
- Create a
devdirectory in your home directory.mkdir ~/dev
- Change directories to
~/devcd ~/dev
- Clone project into
~/devdirectory and alias project directory asmy-projectgit clone {repository_url} my-project
- Create a
Adding Changes to Preexisting Git Repository
- navigate to the root directory of the project on your local machine
- add changes
git add .
- commit change
git commit -m 'update message'
- push changes to web
git push -u origin master
- Refresh the webpage to ensure your changes are visible.
Pulling Changes from Remote Repository to Local Repository
- If there are changes on your remote repository that are not on your local repository, you can execute the command below to fetch the changes.
git pull origin master



