1. Install git

Download it directly from the official website and keep pressing the next step.

Second, configure git

1. Enter the command after git bash is opened, otherwise Git cannot be used

 git config --global user.name xxx
git config --global user.email yyy
git config --global push.default simple
git config --global core.quotepath false

2. Enter the command to generate the secret key

 ssh-keygen -t rsa -b 4096 -C "xxx@xxx.com" //邮箱更换成自己的
然后直接三个回车会生成id_rsa 和id_rsa.pub文件
cat ~/.ssh/id_rsa.pub   //输入命令打开id_rsa.pub
复制内容,在GitHub里新建SSH文件保存即

3. Configure widgets (command usage and query)

 输入命令安装:npm install -g tldr

3. How to use git repository

1. Create a local warehouse

 可以在桌面或在D盘建立一个名为xxx的文件夹;
右击git bash打开;
输入命令git init回车,初始化仓库自动生成.git文件;
然后用户进行自定义创建,修改等步骤;
随后输入命令git add 文件名,把文件暂存;
输入命令git commit -m “XXX”

2. Upload the local warehouse to github and create a new warehouse on GitHub named xxx, which is the same as the local warehouse name;
After the local warehouse modification has completed the steps of def, enter the commands in gitbash in turn, and it is best to copy directly; if you have a local warehouse, just enter the fourth and fifth lines of commands directly;

 echo "abc" >> README.md
git init
git add README.md
git commit -m "XXX"
git remote add origin git@github.com:xxx/xxx.git  
git push -u origin master

3. Download the repository from github

 进入一个仓库,复制ssh地址
建立一个文件夹用Git Bash打开,输入命令git clone “ssh地址”

4. The vscode modification is uploaded to github

 本地仓库完成初始化后生成了.git 文件,把整个文件夹用vscode,在vscode中新增修改代码,分支上传、推送,刷新github仓库页面。

5, github page preview html

 进入一个仓库,点击settings
往下滚动页面,选中master branch 点save
出现一个链接,在末尾加入仓库html文件名,这样以后上传了demo,就可以在描述上添加预览链接。

4. Change the content of the local warehouse and upload it to GitHub

 本地目录下的代码有任何变动,只需按照以下顺序就能上传:

git add 文件路径
git commit -m "信息"
git pull (每次提交前,最好先拉取一次代码)
git push

5. Branches

When you create a repository, master is the "default" branch. Do each iteration of development on other branches, and merge them back into the master branch when you're done.
Create a branch called "1.0.1XXXX" and switch over:

 git checkout -b 1.0.1XXXX

Switch to master branch:

 git checkout master

Delete the newly created branch:

 git branch -d 1.0.1XXXX

Push the branch to your own remote repository:

 git push origin <branch>

沉静地闪光
11.2k 声望3.1k 粉丝

值得做的事情,值得现在就去做并一直坚持做;