❤️ [nanny tutorial] from zero to proficient in Git and CodeChina ❤️

Python full stack basic tutorial series The column contains this content
30 articles 555 subscription

Recommended series of tutorials, recommended must be selected!

One hundred thousand words Python basic tutorial, can't learn the home page, contact me!

Python processing beauty video detailed tutorial

QQ robot production series explanation column
QQ robot B station video tutorial

30000 word SQL database explanation series

1、 Take a look at the preface

For demonstration, I have deleted all git built locally. The articles are written in order, so you should look at and operate by yourself at every step, so that you can learn how to use GIT and CodeChina, a code hosting platform. Because it is all Chinese, it is really a welfare for some people who are not good at English.

2、 Download and install

2.1 download

Official website download address:

https://git-scm.com/downloads

After entering, click window:
Insert picture description here
Click and it will be downloaded automatically.

2.2 installation

Double click the installation package:
Insert picture description here
Check agree:
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Installation complete!

3、 Configure Git

3.1 configuring user names

My name is Chuan user name:

git config --global user.name ”chuan“

3.2 configuring mailbox

This is my own mailbox (change it to yours)

git config --global user.email two billion eight hundred and thirty-five million eight hundred and nine thousand five hundred and seventy-nine@qq.com

demonstration:
Insert picture description here
If the -- global option is used, the changed configuration file is the one located in your user's home directory. In the future, all your warehouses will use the user information configured here by default. If you want to use other names or e-mail in a specific warehouse, just remove the -- global option and reconfigure it. The new settings are saved in the. Git / config file of the current warehouse Li (understand that you don't have to memorize)

3.3 generate key

Or my email as an example

ssh- -t rsa -C ' 2835809579@qq.com '

Just press enter multiple times and create the. SSH file locally (if you don't get my result, execute it again)
Insert picture description here
The generated public key file id_rsa.pub is: / C / users / HP /. SSH / id_rsa.pub
Take a look at the generated folder below:
Insert picture description here
Open it again:
Insert picture description here

Copy all the contents of this file and use it later.

3.4 configuration

Of course, if you haven't used CodeChina, you are confident to register your account at the website (there's nothing to say about registration). Of course, there is also a simple pure white tutorial portal:
Portal
Then take my account as an example (you can click it yourself):

https://prog3.com/sbdm/codechina/weixin_46211269/test

Click as follows:
Insert picture description here
Insert picture description here
Ctral + A, ctral + C:
Insert picture description here
Then we get the following results:
Insert picture description here
Then I received CodeChina's email (too lazy to read)

4、 Warehouse operation

4.1 new warehouse

The sequence is as follows:
Insert picture description here

Insert picture description here
Insert picture description here
Fill in information (you can customize):
Insert picture description here
Wait a few tens of seconds to see the following interface:
Insert picture description here
Now this is my warehouse address (one person can have multiple warehouses):

https://prog3.com/sbdm/codechina/weixin_46211269/chuan

4.2 initialize local:

git init

The demonstration is as follows:
Insert picture description here

4.3 associating local and remote warehouses

Copy SSH link:
Insert picture description here
Execute command:

Git remote add origin project SSH address

Take my own warehouse as an example:

git remote add origin  git@codechina.csdn.net:weixin_46211269/chuan.git

Demo (you can see that there is an additional parenthesis for the master, and the synchronization has been successful):

Insert picture description here

4.4 cloning project

Git clone SSH address

What's the SSH address again? This:
Insert picture description here
For example, I want to clone my project now:

git clone   git@codechina.csdn.net:weixin_46211269/chuan.git

The demonstration is as follows:
Insert picture description here
Where did you download it? It's the same level directory as. SSH.
Insert picture description here
Then the problem comes. You certainly don't want to download the project to this location, so we want to customize the download to a location. It's not difficult. We just need to add a custom path on the basis of the previous commands.
For example, I want to download to this path:
Insert picture description here
Right click under this path:
Insert picture description here

Execute the command again:

git clone   git@codechina.csdn.net:weixin_46211269/chuan.git 

The demonstration is as follows:
Insert picture description here
This has been successful:
Insert picture description here
What if you want to clone it as another file name? I don't want to download it as Chuan by default. For example, I want to clone the folder called test. It's also very simple. Add test after the command just now:

git clone   git@codechina.csdn.net:weixin_46211269/chuan.git test

The demonstration is as follows:
Insert picture description here

4.5 uploading files

First step: CD to the Chuan folder (that is, the name of the warehouse project folder we synchronized)
Insert picture description here
Step 2: initialize local warehouse

git init

demonstration:
Insert picture description here

Step 3Suppose I add files to this local folder as follows:

Insert picture description here
Step 4: git view the remote warehouse command (of course, you can not execute this step, this step is just to ensure that the previous step is successful)

git status

The demonstration is as follows:
Insert picture description here
Step 5: submit to the hold area (execution is, you can't understand)
This command means to add all files.

git add .

This command is equivalent to:git add -A, I won't demonstrate
The demonstration is as follows:
Insert picture description here
Step 6: submit file: git commit - M "your comments"
For example, I execute the following command:

git commit -m "Test submission comments"

The interface is as follows:
Insert picture description here
Of course, you can also submit a single file without demonstration. The command format is as follows:

git commit -m "Note information"file name

Step 7: get the remote library and merge with the local synchronization (this step must be done if the remote library is not empty, otherwise the subsequent submission will fail)

git pull --rebase origin master

The demonstration is as follows:Insert picture description here

Step 8: update synchronization remote warehouse

git push -u origin master

Interface demonstration:
Insert picture description here
Now refresh the warehouse interface and you can see that the submission is successful:
Insert picture description here

4.6 deleting items

If you don't want this warehouse, it is as follows:
Insert picture description here
Insert picture description here
Insert picture description here

5、 Some basic commands

5.1 view associated warehouses

git remote -v

Demo (you can see that the local has been associated with the project address just now):
Insert picture description here

5.2 close synchronization warehouse

If I don't want to synchronize this warehouse, how can we delete this synchronization warehouse?

Git remote RM SSH project address

For example, if I:

git remote rm  git@codechina.csdn.net:weixin_46211269/chuan.git

Demo (the following indicates that it has been deleted successfully):
Insert picture description here

5.3 associated warehouse

Of course, as mentioned earlier in this step, you can try again to strengthen memory and understanding. If you want to re associate, execute the following command:

git remote add origin  git@codechina.csdn.net:weixin_46211269/chuan.git

Demo (GIT remote -v check every time you delete and add suggestions to the warehouse):
Insert picture description here

5.4 status review

git status

demonstration:
Insert picture description here

6、 Summary

Each of the above steps is operated according to my tutorial. You must learn to use GIT. Of course, you should learn basic flexibility. For example, I demonstrate that it is your own warehouse, and you should use your own warehouse link when operating. It is not easy to generate electricity for love. Your triple connection and attention are my great support. Thank you very much!

emoticon
Insert expression
©️ 2020 CSDN Skin theme: years Designer: pinmode Return to home page
Paid inelement
Payment with balance
Click retrieve
Code scanning payment
Wallet balance 0

Deduction Description:

1. The balance is the virtual currency of wallet recharge, and the payment amount is deducted according to the ratio of 1:1.
2. The balance cannot be purchased and downloaded directly. You can buy VIP, c-coin package, paid column and courses.

Balance recharge