gitee is the most detailed tutorial, summarizing the whole network, just read this article

1. What is gitee?
Git-based code hosting assistance platform

2. Register and log in on the git website
Open the gitee official website Gitee - a Git-based code hosting and R&D collaboration platform to open the registration and log in. E-mail registration is the best, and non-emails can add their own e-mail in personal-settings.

Novices please disclose your email address, as shown in the picture:

 

 

3. Preparatory work
1. Tool 1: git-bit installation, see this for
Git
https://git-scm.com/ installation tutorial.

 

2. Tool 2: TortoiseGit.msi little turtle (optional software)

    This software is for graphical way. There is a sequence of installation.

3. Configure RSA public key

1) Open git bash, right click anywhere, because it is still being configured.

 2) Enter the code to realize the association between the git account and the local.

ssh-keygen -t rsa -C "Your mailbox"
has been pressed, a total of three times, although a colon appears, but do not need to fill. 

3) After the end, enter to view your own key:

cat ~/.ssh/id_rsa.pub

 

4) Copy all the keys below to the website:

On the official website --- personal --- settings --- ssh public key --- copy the following public key text field (large input box) --- the title above is changed at will, for yourself --- -Sure.

5) Test whether it is connected to the remote own account.

 ssh -T [email protected]
6) Create a remote warehouse

Open the official website and create a new warehouse.

After creating a successful jump, click Clone to download, and then copy the address of ssh to upload and download (the address will be used later)

4. Upload files to gitee
1) Create a new folder

2) Enter the newly created folder, that is, enter "gitspace", click the right mouse button, and select "Git Bash Here", as shown below:

 

3) Perform basic configuration, also called global settings. As the basic configuration of git, its function is to tell git who you are, and the information you enter will appear in the submission you created. Use the following two commands:

  git config --global user.name "your name or nickname"
  git config --global user.email "your email"
Look at the interface I run:

 

Intermediate process: 

 

After pasting, it will appear to run directly, use the up key to modify the code, don't worry if it doesn't appear, double quotes can be omitted.

Name website home page. The email address was just set up.

 

 4) Enter the initialization command git init and press Enter, and a hidden folder appears in the folder. This step is to initialize the local file as a local repository.

5) Enter the address to link to Code Cloud, (the address we copied earlier) and press Enter.

git remote add origin Address
6) Put any file in this new folder.

Insert it, enter to view the file loading of this folder

The git status command is used to check whether the file has been modified again after your last submission
7) Enter the command:

git add .
8) Add a comment to explain why you want to upload it, so that you can check it later. For example:

 git commit -m "first upload" 
9) Submit to Code Cloud, git push origin master

Because it is the first submission, it needs to be changed to:

For the second submission of git push -u origin master
  , just follow the above method, and you don’t need to add -u anymore.

Note: If an error is reported in the last step, you can use git push -f origin master to force overwrite.

 
   git push origin master //(normal submission) and
   git push origin master -f //(mandatory submission, which may remove the previous commit comment information and will not change the modified code, use with caution), both are submitted to master The branch
execution result is shown in the figure: 

  

 

Refresh the gitee website and there it will be. The position of -f does not seem to affect it, and the sharp-eyed ones found it, very good. Others need to enter at this step

 

Just enter your username (email) and password for the website.

5. Download your own warehouse and
      a new folder created by others for easy viewing. Enter this folder, right mouse button - open the git bash command window - copy the ssh link on the website - enter the command git clone in the Git window just now and then Just right click.

git clone url
*6. Summary of basic commands:
Git's job is to create and save a snapshot of your project and compare it with subsequent snapshots. He has four positions:

workspace: work area
staging area: temporary storage area/cache
local repository: version library or local warehouse
remote repository: remote warehouse
git init initializes warehouse
git clone copies a remote warehouse, that is, downloads a project.
git add Add files to the temporary storage area
git status View the current status of the warehouse and display changed files.
git diff compares the difference between files, that is, the difference between the temporary storage area and the work area.
git commit Submit the temporary storage area to the local warehouse.
git reset rollback version.
git rm removes workspace files.
git mv moves or renames workspace files.
git log View historical submission records
git blame <file> View historical modification records of specified files in a list
git remote remote warehouse operation
git fetch Obtain code base from remote
git pull download remote code and merge
git push upload remote code and merge
other common git Order

View all branches: git branch -a

Switch to a branch: git checkout branch name

Merge branch: git merge original branch target branch

4. Update the code to the local
git status (check the local branch file information to ensure that there is no conflict when updating)

git checkout -- [file name] (if the file has been modified, it can be restored to the original state; if the file needs to be updated to the server, it should be merged to the server first, and then updated to the local)

git branch (view current branch status)

git checkout remote branch

git pull

If the command is executed successfully, the update code is successful!

You can directly use: git pull command to update the code in one step
 

Guess you like

Origin blog.csdn.net/lm_love_hxl/article/details/129950999