From 521fb3dc5de606114ac5cebbb654336492d7461f Mon Sep 17 00:00:00 2001 From: Cameron McEfee Date: Fri, 25 Feb 2011 13:26:21 -0800 Subject: commit before deleting the 'explain it' styles --- _posts/2011-02-15-linux-set-up-git.markdown | 147 +++++++++++++++++----------- 1 file changed, 88 insertions(+), 59 deletions(-) (limited to '_posts/2011-02-15-linux-set-up-git.markdown') diff --git a/_posts/2011-02-15-linux-set-up-git.markdown b/_posts/2011-02-15-linux-set-up-git.markdown index 5f53caf..8b58ae6 100644 --- a/_posts/2011-02-15-linux-set-up-git.markdown +++ b/_posts/2011-02-15-linux-set-up-git.markdown @@ -28,119 +28,148 @@ _*If you don’t already know what Git is, -

Need a quick lesson about Terminal? -  Code blocks like those on this page are part of a scripting language called Bash. To use Bash scripts, we need to use an application that comes with Linux called Terminal. A line that begins with the dollar sign ($) indicates a line of code you need to type. To enter it, type the text that follows the $, hitting the return key at the end of each line. If you see a line in an example that doesn’t begin with a $ (we’ve made them green in the bootcamp tutorials), that means it is a line of text that terminal has output for you to read and/or act upon. In the bootcamp examples, you can roll over the lines of Bash script for an explanation of what they do.

- - Good to know: There will be times when you type code, hit return, and all you are given is another prompt. Some actions that you execute in the Terminal don’t have any output. Don’t worry, if there is ever a problem with your code, Terminal will let you know.

- - Good to know: For security reasons, Terminal will not display what you type when entering passwords. Just type your password and hit the return key. -
+ +   + +

Code blocks like those on this page are part of a scripting language called Bash. To use Bash scripts, we need to use an application that comes with Linux called Terminal.

+ +

Input

+
+				$ echo 'This is input text'This tooltip tells you what's going on.
+			
+ +

A line that begins with the dollar sign ($) indicates a line of Bash script you need to type. To enter it, type the text that follows the $, hitting the return key at the end of each line. You can hover your mouse over each line to see what the script is doing

+ +

Output

+
+				$ This is output text.
+			
+ +

A line that does not begin with a $ is output text that is intended to give you information or tell you what to do next. We've colored output text green in these bootcamp tutorials.

+ +

User Specific Input

+
+				$ echo 'username'Outputs the text in the quote marks.
+			
+ +

Areas of yellow text represent your own personal info. If it is part of an input ($) line, you should replace your it with your own info when you type it. If it is part of output text, it is just for your reference. It will automatically show your own info in Terminal

+ +

Good to know: There will be times when you type code, hit return, and all you are given is another prompt. Some actions that you execute in the Terminal don’t have any output. Don’t worry, if there is ever a problem with your code, Terminal will let you know.

+ +

Good to know: For security reasons, Terminal will not display what you type when entering passwords. Just type your password and hit the return key.

+ + -

1. Check for SSH keys. Have an existing kepair? You can skip to Step 4. First, we need to check for existing ssh keys on your computer:
-	$ cd ~/.sshChecks to see if there is a folder named ".ssh" in you user directory
+	$ cd ~/.sshChecks to see if there is a folder named ".ssh" in you user directory
 	
-

Does it say "No such file or directory"?

-

No: Go to Step 2
Yes: Skip to Step 3 -

+ If it says “No such file or directory“ skip to __step 3__. Otherwise continue to __step 2__. + 2. Backup and remove existing SSH keys. Since there is already an SSH directory you’ll want to back it up and remove it:
-	$ lsLists all the subdirectories in the current directory
-	config  id_rsa  id_rsa.pub  known_hosts
-	$ mkdir key_backupMakes a folder called "key_backup" in the current directory
-	$ cp id_rsa* key_backupCopies the contents of the id_rsa folder into key_backup folder
-	$ rm id_rsa*Deletes the contents of the id_rsa folder
+	$ lsLists all the subdirectories in the current directory
+	config  id_rsa  id_rsa.pub  known_hosts
+	$ mkdir key_backupMakes a folder called "key_backup" in the current directory
+	$ cp id_rsa* key_backupCopies the contents of the id_rsa folder into key_backup folder
+	$ rm id_rsa*Deletes the contents of the id_rsa folder
 	
3. Generate a new SSH key. - To generate a new SSH key, enter the code below. When asked to enter a file in which to save the key, just press enter without typing anything. + To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
-	$ ssh-keygen -t rsa -C "octocat@github.com"Creates a new ssh key using the provided email
-	Generating public/private rsa key pair.
-	Enter file in which to save the key (/home/octocat/.ssh/id_rsa):
-	Enter passphrase (empty for no passphrase):
-	Enter same passphrase again:
+	$ ssh-keygen -t rsa -C "user_name@username.com"Creates a new ssh key using the provided email
+	Generating public/private rsa key pair.
+	Enter file in which to save the key (/home/your_user_directory/.ssh/id_rsa):
+	
+ + Now you need to enter a passphrase. _[Why is this important?](../working-with-key-passphrases)_ + +
+	Enter passphrase (empty for no passphrase):
+	Enter same passphrase again:
 	
Which should give you something like this:
-	Your identification has been saved in /home/octocat/.ssh/id_rsa.
-	Your public key has been saved in /home/octocat/.ssh/id_rsa.pub.
-	The key fingerprint is:
-	01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db octocat@github.com
-	The key's randomart image is:
-	+--[ RSA 2048]----+
-	|     .+   +      |
-	|       = o O .   |
-	|        = * *    |
-	|       o = +     |
-	|      o S .      |
-	|     o o =       |
-	|      o . E      |
-	|                 |
-	|                 |
-	+-----------------+
+	Your identification has been saved in /home/your_user_directory/.ssh/id_rsa.
+	Your public key has been saved in /home/your_user_directory/.ssh/id_rsa.pub.
+	The key fingerprint is:
+	01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db user_name@username.com
+	The key's randomart image is:
+	+--[ RSA 2048]----+
+	|     .+   +      |
+	|       = o O .   |
+	|        = * *    |
+	|       o = +     |
+	|      o S .      |
+	|     o o =       |
+	|      o . E      |
+	|                 |
+	|                 |
+	+-----------------+
 	
4. Add your SSH key to GitHub. On the GitHub site _Click “Account Settings”_ > _Click “SSH Public Keys”_ > _Click “Add another public key”_ - It’s important you copy your SSH key exactly as it is written without adding any newlines or whitespace. To ensure this, run the following code to copy the key to your clipboard. + __It’s important you copy your SSH key exactly as it is written without adding any newlines or whitespace.__ To ensure this, run the following code to copy the key to your clipboard.
-	$ sudo apt-get install xclipDownloads and installs xclip
-	$ cat ~/.ssh/id_rsa.pub | xclip -sel clipCopies the contents of the id_rsa.pub file to your clipboard
+	$ sudo apt-get install xclipDownloads and installs xclip
+	$ cat ~/.ssh/id_rsa.pub | xclip -sel clipCopies the contents of the id_rsa.pub file to your clipboard
 	
- Now paste it into the “Key” field + Now paste it into the “Key” field. - Paste your SSH Key + Paste your SSH Key - Hit “Add Key” + Hit “Add Key.” 5. Test everything out. - To make sure everything is working you'll now SSH to GitHub: + To make sure everything is working you’ll now SSH to GitHub. Don’t change the “git@github.com” part. That’s supposed to be there.
-	$ ssh git@github.comAttempts to ssh to github
+	$ ssh git@github.comAttempts to ssh to github
 	
Which should give you this:
-	The authenticity of host 'github.com (207.97.227.239)' can't be established.
-	RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
-	Are you sure you want to continue connecting (yes/no)?
+	The authenticity of host 'github.com (207.97.227.239)' can't be established.
+	RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
+	Are you sure you want to continue connecting (yes/no)?
 	
Don’t worry, this is supposed to happen. Type “yes”.
-	Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
-	ERROR: Hi octocat! You've successfully authenticated, but GitHub does not provide 
shell access
- Connection to github.com closed. + Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts. + ERROR: Hi username! You've successfully authenticated, but GitHub does not provide
shell access
+ Connection to github.com closed.
+ + You don’t worry, about the “ERROR”. You actually want to see that. ##Then: Set Up Your Info @@ -151,23 +180,23 @@ Now that you have Git set up and your SSH keys entered in GitHub, it’s tim Git tracks who makes each commit by checking the user’s name and email. In addition, we use this info to associate your commits with your GitHub account. To set these, enter the code below, replacing the name and email with your own. The name should be your _actual name_, not your GitHub username.
-	$ git config --global user.name "The Octocat"Sets the name of the user for all git instances on the system
-	$ git config --global user.email "octocat@github.com"Sets the email of the user for all git instances on the system
+	$ git config --global user.name "Firstname Lastname"Sets the name of the user for all git instances on the system
+	$ git config --global user.email "user_name@username.com"Sets the email of the user for all git instances on the system
 	
2. Set your GitHub token. Some tools connect to GitHub without SSH. To use these tools properly you need to find and configure your API Token. - On the GitHub site _Click “Account Settings”_ > _Click “Account Admin”_ + On the GitHub site _Click “Account Settings”_ > _Click “Account Admin.”_ Copy your API token In Terminal, run the following code, using your GitHub username and token in place of the ones shown.
-	$ git config --global github.user octocatSets the GitHub username for all git instances on the system
-	$ git config --global github.token 0123456789abcdef0123456789abcdefSets the GitHub token for all git instances on the system
+	$ git config --global github.user usernameSets the GitHub username for all git instances on the system
+	$ git config --global github.token 0123456789your0123456789tokenSets the GitHub token for all git instances on the system
 	
__*Note*__ If you ever change your GitHub password, a new token will be created and will need to be updated. -- cgit v1.3.1