Git and GitHub (use git to upload local files to GitHub)

Source: Internet
Author: User

GitHub is a code repository (a tool for managing code) that can be shared with everyone

Git is the tool for extracting files from GitHub or uploading local files to GitHub (equivalent to SVN)

Uploading projects with Git

Step One: (User and mailbox for your GitHub registered account and email)

$ git config --global user.name "startstudysmile"$ git config --global user.email "[email protected]"

Step two: Set up SSH key

 $ ssh-keygen -t rsa -C "[email protected]"

生成过程中一路按3次回车键就好了。
生成成功后,去对应目录C:\用户\Administer\.ssh里(
Administer为电脑用户名,每个人不同)用记事本打开id_rsa.pub文件
复制里面的内容,得到ssh key公钥。

Step three: Configure SSH key for GitHub account

GitHub website >setting>ssh and GPG keys>new SSH key

Paste the copied public key into the corresponding area and click the Add SSH Key button

Step four: Build a local warehouse

Open the file you want to upload and click Git bash to start typing the command

1 $ git init (after initialization succeeds, there will be a hidden folder in the folder. Git)

Click Tools > Folder Options > View > Show hidden files, folders, and drives to see the. git file in the folder

2 $ git Add. ( add all files to the warehouse )

Note that there is a point later.

3 $ git commit-m "commit file" (file commit operation)

Note that the contents of the following double quotation marks are comments

Step Five: associated GitHub repositories

Find a project you created on GitHub and open this project

1 to GitHub text warehouse copy warehouse address

2 $ git Remote Add Origin https://github.com/startstudysmile/webProject.git (later https://is the warehouse address you copied)

3 $ Git push-u origin master (upload local code, wait for upload, please be patient)

Finally, the upload succeeded!!





Git and GitHub (use git to upload local files to GitHub)

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.