Install Git on your MacBook and use GitHub as your hosting server

Source: Internet
Author: User
Tags hosting git clone macbook

First install Git, go to the official website and download: address, download and install, you can enter the command line to see if the installation is successful:

sh-3.2#  git--versiongit version 2.7.1

After installation, we will configure our git, here you name and [email protected], is you register github user name and mailbox, here to pay attention!

" You Name "  --global user.email [email protected]

Then you can register GitHub, address, register well, and then enter the command:

Ssh-keygen-c ' [email protected] '-t RSA

This will generate the Ssh-key locally,

After the build, we copy the path:/var/root/.ssh/id_rsa.pub inside the content, and open GitHub setting, and in SSH and GPG keys, click New SSH key, enter title, and paste your ssh-key just now, and save,

By doing this, you can now test whether local git is connected to GitHub successfully via the command line

ssh-v [email protected]

After that, you can download the code from github to local and, of course, you can upload the local code to the server. Let's start by downloading the code on GitHub to local, open the project address on GitHub, and copy the project address,

Enter the command:

git clone [email protected]:zhangwei900808/chargepile.git

Next, just wait for the download to complete. Next, how to upload your native code to GitHub, 1th: Create a new respository on GitHub, name it yourself, and other options by default.

Click: Create Repository, after which you will see:

You'll find that there are three ways to add code:

1: Create a new warehouse from the command line

2: Push the existing warehouse through the command line

3: Import other warehouse code directly

Of course, you can add as you want.

Note: GitHub has a personal-created warehouse and a warehouse created by the organization, this should be noted, because the corresponding commands will also change. For example, if you are uploading to a personal repository, command:

git remote add origin [email protected]:zhangwei900808/-U Origin Master

If uploading to an organization's personal repository, command:

git remote add origin [email protected]:awbeci/-U Origin Master

Resources:

http://blog.csdn.net/a695017449/article/details/26103761

https://git-scm.com/book/zh/v1/%E8%B5%B7%E6%AD%A5-%E5%88%9D%E6%AC%A1%E8%BF%90%E8%A1%8C-Git-%E5%89%8D%E7%9A%84% E9%85%8d%e7%bd%ae

Install Git on your MacBook and use GitHub as your hosting server

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.