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)