Use GitHub on Mac-set git

Source: Internet
Author: User
Tags version control system

Source: http://help.github.com/mac-set-up-git/

Set up git Step 1: download and install git

GitHub's core is an open-source version control system called git *, which was created by the guy who created Linux. Everything you have locally related to GitHub is actually managed by git.

1. download and install the latest version of git. Note: Do not worry if you do not see any icons after installation, because it is not a common application. (Note: it is actually a command line tool)
Step 2: Set the SSH key

We use SSH to implement encrypted communication between the client and GitHub. It is easy to set them, but several steps are required.

To ensure that you have created a new key, you need to first determine whether a key already exists. First, open the terminal, generally in Application --> utilities

1. Check the SSH key (if the key already exists, skip to step 4) 2. First, check whether the SSH key is available on the computer: $ Cd ~ /. SSH

If the system prompts "no file or folder" ("No such file or directory"), skip to Step 3. Otherwise, continue.

3. Back up and remove the original SSH key

Because you already have SSH key-related folders, you need to back up and delete them.

$ Ls # display all files and folders in the current folder. Folder $ mkdir key_backup # create a folder named "key_backup" in the current directory $ CP id_rsa * key_backup # copy id_rsa and id_rsa.pub to key_backup $ RM id_rsa *

4. Create a New SSH key

Enter the following command to create a new SSH key. Because we directly use the default settings, when asked where to save the key, press Enter.

$ Ssh-keygen-t rsa-c "your_email@youremail.com" # Use the email address you provided to create a new SSH key generating public/private RSA key pair. enter file in which to save the key (/users/your_user_directory /. SSH/id_rsa): <press enter>

Enter the password

Enter passphrase (empty for no passphrase):<enter a passphrase>
Enter same passphrase again:<enter passphrase again>

Press enter. If it is correct, the following information should be displayed:

Your identification has been saved in /Users/your_user_directory/.ssh/id_rsa.Your public key has been saved in /Users/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.comThe key's randomart image is:+--[ RSA 2048]----+|     .+   +      ||       = o O .   ||        = * *    ||       o = +     ||      o S .      ||     o o =       ||      o . E      ||                 ||                 |+-----------------+

5. Add your SSH key to GitHub

5.1 click on the GitHub website"Account settings">Click
"SSH keys"
>Click
"Add SSH key"

Open the id_rsa.pub file in a text editor ). This file is your public key. You need to open "Browse hidden file" to find it, because the. Ssh folder is hidden. Note that when you copy a key from a file, note that the key file does not contain any blank space or line breaks: so do not copy unnecessary lines or spaces when copying them)

Next, paste the key into the key text box.

Click Add key.

5.2 Test whether everything goes well

To ensure that everything works properly, you need to try to log on to GitHub through SSH. Note that the "git@github.com" section in the following command does not need to be changed.

$ ssh -T git@github.com

You should see the following results:

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)?

"Yes"

Hi username! You've successfully authenticated, but GitHub does not provide shell access.
Next, set your information

Now that you have configured git and entered your SSH key to GitHub, it is your turn to set your personal information.

  1. Set your user name and email address
  2. Git will still follow the user name and email address for submission. In addition, we use this information to associate your submission with the GitHub account. Enter the following command to replace name and email with your name and email address. The name must be your real name rather than your GitHub account.

    $ Git config -- global user. name "firstname lastname" # Set the username $ git config -- global user for all git instances on your machine. email "your_email@youremail.com" # Set your mailbox for all git instances on your machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.