Git submits projects to Code Cloud or GitHub (even beginners can understand, with detailed explanations in pictures and texts)

1. Build a remote warehouse on gitee and connect it to the local

Register a gitee account first

Gitee - Enterprise-level DevOps R&D performance platform

Create a new warehouse on Code Cloud to store projects

 

First execute it anywhere locally: right-click, git bash here (provided you have installed git)

Configure global username and email

git  config --global user.name "Your Name"
git  config --global user.email "[email protected]"

For example, mine is

git config --global user.name "kyw"
git config --global user.email "[email protected]"

Configure SSH to connect locally

Generate sshkey

In the local repository git bash Here

ssh-keygen  -t rsa 

After executing the above command, press Enter all the way. If you are doing it for the second time, you will be asked whether to overwrite it. Just enter y and press Enter.

Check the contents of the public key, copy it and save it

cat  ~/.ssh/id_rsa.pub

 

 Copy from ssh-rsa to the end, this is your public key.

You can also go to the following path to find: c drive>Users>Kang Youwei>.ssh. There are public and private keys. Copy the public key.

Go to Code Cloud and paste the public key

 

 2. Clone the remote repository to local

The remote warehouse is now empty, or there may be an initial file. Let's clone it first.

Wherever you want to clone, create a folder there and right-click git bash here

git clone

Behind + copy the remote warehouse ssh address

You can see that it has been cloned locally.

 

 3.Write a project

Put the project file you wrote into the file you just cloned

If you have already written the project, just copy it directly to this folder.

For example, I test a TXT file

 

 4. Once the project is written, start submitting it

Right-click on a blank space (must be under the local warehouse path), Git Bash Here

Enter it again

Initialize warehouse

git init

Submit from workspace to cache

At this step, it has not been submitted to the code cloud, but has been submitted to the staging area.

You can choose to submit one by one, or submit them all at once

submit a file

git  add 刚刚写的代码.txt

Or submit them all directly

git add .

 Submit from the staging area to the local warehouse

It hasn’t been submitted to Code Cloud yet.

git  commit -m"这里写备注"

Local warehouse to code cloud

 This step is handed over to Code Cloud.

git push

You can see that the submission was successful

 

Guess you like

Origin blog.csdn.net/KangYouWei6/article/details/132497753