How to use git to connect to GitHub and common git commands

Download and install Git

Configure username and email

git config --global user.name "Your Name" 
git config --global user.email "Your Email"  

Use the command: git config --list to view current user information and some other information

View username and email

git config user.name
git config user.email

Build a warehouse on GitHub

Initialize the warehouse

git init

Add all files of the project to the cache

git add .

Commit the files in the cache to the git repository

git commit -m "添加你的注释,一般是一些更改信息"

Link the local library to the remote warehouse

The address is your warehouse address on GitHub
git remote add origin https://github.com/Luo-Zhigang/my-mall.git

If Git prompts fatal: remote origin already exists, you can use the following command to remove the repository

git remote rm origin

Then upload the code to the remote warehouse after reconnecting

git remote add origin https://github.com/Luo-Zhigang/my-mall.git
git push -u origin master

Guess you like

Origin blog.csdn.net/dwjdj/article/details/110732627
Recommended