Setting up Git Git Bash and Git Hub
Setting up Git, Git. Bash, and Git. Hub
https: //git-scm. com/downloads Download and install git and git. Bash. For the first install I recommend just accepting all the default options. After you have become familiar with the process you can go back and tweak things while installing. (there may be more steps than I have shown)
Start Git. Bash with a Desktop shortcut … or right-click menu …or Start Menu
Setup the global user data for your local Git git config --global user. name “user_name” git config --global user. email “emailname@yourmail. com” Make sure that you set this up with the exact same email that you used or will use when you create your Git. Hub account. Setup the default text editor examples for notepad++ and Sublime 3 on Windows 7: git config --global core. editor "'C: /Program Files (x 86)/Notepad++/notepad++. exe' -multi. Inst -nosession" git config --global core. editor "'C: /Program Files (x 86)/Sublime Text 3"/sublime_text. exe' -w"
Create a Git Repository on your local machine (for quick practice example) # Ignore everything * Createing a Git repository on your local machine. Make a folder in your drive and open git. Bash in that folder git init Create a readme. txt or read. Me. md file Create a. gitignore file touch. gitignore Edit the. gitignore file based on the structure of your project git add. git commit –m “first commit in project” # But not these files. . . !. gitignore !src/** !libs/** !*. txt !*. md # MAC HIDDEN FILES. DS_Store
Using Git to manage version control for a local repository (short version lecture) setting up repo create. gitignore first commit branching git checkout merging merge conflict resolution commonly used git commands: git init git status git log --oneline --decorate --graph --all git add. git commit -m “message” git branch <new. Branch. Name> git checkout <branchname> git push origin <branchname> git pull origin <branchname> git merge <branchname>
Connecting your local Git repository to your remote Git. Hub repository The following material is pulled from the online Git. Hub help documentation. https: //help. github. com/articles/connecting-to-github-with-ssh/ The details of this process is bound to change so make sure to access the original source in the future. Alternatively it can usually be found with the search “ssh for github”
Setup ssh using Git. Bash command line https: //help. github. com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ ssh-keygen -t rsa -C <your_email@example. com> Example: ssh-keygen -t rsa –C richard. csdept@gmail. com Same recommendation as before. For initial setup of your system just keep hitting enter and accepting the default settings. You can go back later and adjust things after you have gotten everything working the first time. Register this key with the Git. Bash application. eval $(ssh-agent -s) //starts the ssh agent, note the ` from the ~ key ssh-add ~/. ssh/<name of rsa file> ssh-add ~/. ssh/id_rsa. pub Public key default location on windows 7: C: Users<username>. sshid_rsa. pub //this is the default location and name
Set up an account on Git. Hub Navigate to: https: //github. com/ Set up an account
Add this public key to your Git. Hub account
Add the ssh key to your Git. Hub account Make sure to give it a title that will help you remember where it came from when you look at it again in about a year or two.
Test to see whether you can connect to git. Hub https: //help. github. com/articles/testing-your-ssh-connection/ Run this command in git. Bash (or Mac/Linux terminal) ssh –T git@github. com You should see a response similar to this: The authenticity of host 'github. com (192. 30. 252. 1)' can't be established. RSA key fingerprint is 16: 27: ac: a 5: 76: 28: 2 d: 36: 63: 1 b: 56: 4 d: eb: df: a 6: 48. Are you sure you want to continue connecting (yes/no)? Type yes If the connection is working you should see this: Hi username! You've successfully authenticated, but Git. Hub does not provide shell access.
Make an empty repository on Git. Hub
Your new empty Git. Hub repository
Push a local repository to Git. Hub After creating an empty repository on Git. Hub follow the instructions the provide to push a local repository to that remote repository. git remote add origin git@github. com: rkjc/My-new-newest-repo. git push -u origin master
- Slides: 19