git tutorial notes

What is git: is a distributed management version control tool

Distributed: Each host can run independently without affecting each other, and finally can also cooperate to complete something. For example: git Centralized: There is a central host to manage and there are dependencies

git view version

git --version

Generate ssh public key

ssh-keygen -t rsa -C “[email protected]

ssh-keygen -t rsa -C “[email protected]” 
通常生成2个文件,存放在c:/Users/你的用户名/.ssh/

 id_rsa
 id_rsa.pub (放到远程仓库上)

 settings->ssh-new sshkey-->输入标题和id_rsa.pub内容

Clone the github/gitee remote warehouse to the local (take GitHub as an example)

ssh:[email protected]:aa1655694937/mall.git
https:https://github.com/aa1655694937/mall.git
下载下来,然后进去git
git clone 地址

git clone 使用 git clone 拷贝一个 Git 仓库到本地,让自己能够查看该项目,或者进行修改。

Common git commands:

1. Initialize git: git init

 注:在项目根目录下产生一个.git文件

2. Add: git add file name

例如:git add index.html
或者  git add *

3. View file status: git status

4. Submit the local warehouse: git commit -m'describe when submitting'

例如: git commit -m 'lgd提交了index.html'

5. View remote warehouse (information)

git remote -v  查看远程仓库信息

Use git to push the project to the remote warehouse

Remote warehouse: domestic (for example: code cloud gitee), foreign: github

Take GitHub as an example:

1.先注册或登录github
2.在本地生成公钥和密钥
3.测试连通
 ssh -T [email protected]

 最后:You've successfully 
4.连接远程
5.推送
git push 远程仓库名称(默认为origin) 分支(master)

git remote add origin remote warehouse address


What is the process of using git?

Use git process: git add, git commit, git push

Pull items:

第一次:git clone 远程克隆仓库的地址
第二次:git pull

What is the relationship between working area, temporary storage area, local warehouse, and remote warehouse? ? ?

Insert picture description here
Work area -git add ->temporary area -git commit ->repository -git push ->remote warehouse

git add

git commit 

git push

Guess you like

Origin blog.csdn.net/dongdongaa0/article/details/107028169