Introduction to the basic use of gitee

code cloud notes

  • Definition: It is a domestic cloud storage warehouse developed based on the gittee protocol. (free). For programmers: it is mainly used for code hosting. (Generally, it is mainly used for version control when working in a team)

  • Download git, the normal official download is too slow, choose the mirror download address: https://npm.taobao.org/mirrors/git-for-windows/

  • Install the git client (just click the next step)

  • Then on the computer desktop, right-click and select Git Bash Here to enter the panel for configuration

    • Input: git config --global user.name "User name defined by yourself"
    • Input: git config --global user.email "Own email"
    • Final check: git config --global --list to see if the configuration was successful
      Please add a picture description
  • Register the code cloud account to log in, and then set the local machine to bind the SSH public key to achieve password-free login (code cloud is a remote warehouse, we usually work in the local warehouse, do not set the password to be entered every time push)

  • ① Once you enter the code cloud, there is an option to create a warehouse in the lower left menu, click (warehouse, that is, the location where one of our local projects will be stored on the code cloud)

  • ② After entering the creation page, fill in the warehouse name (the warehouse path will be automatically generated after filling in), warehouse introduction, and select the language used for the project (just complete these three steps), and click Create

  • ③ After it is created, it will automatically enter the warehouse view, find the management menu in the upper menu bar, and click

  • ④ After entering, find the lower left menu - deploy public key management - "add public key.

  • ⑤ Enter the view of adding a public key and enter the title (it has no effect, just an identification)

  • ⑥ Right-click on the computer desktop and select the menu option of the newly installed git client: bit bash here.

  • ⑦ Enter ssh-keygen -t rsa -C "[email protected]" in the interactive window [you need to pay attention to change the mailbox to your own mailbox]

  • ⑧ Enter (first time) - "Enter (second time) - "Enter (third time) [don't doubt, it is three times in a row]

  • ⑨ Enter cat ~/.ssh/id_rsa.pub in the interactive window and press Enter, the console will display the key string, which is your public key.

  • 10 Copy the string to the public key text box of the code cloud platform. Don't worry about spaces, the text box will automatically format the public key for us.

  • 11 Confirm the addition.

  • 12 In the interactive window, enter ssh -T [email protected] (if you are using github, replace gitee) and press Enter, if the console displays: Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access. content, it proves that the addition is successful.

  • 13 git is installed and configured for remote connection. The following can be used directly

  • 14 In the process of use, all pop-up windows need to enter the user name and password are the user name and password at the time of registration

git client uses

  • Method 1 Clone the remote repository:
    • 1. Find a folder to be stored, enter the folder, right click and select git bash Here
    • 2. Window input: git clone needs to download the warehouse connection and press Enter
      • The GitHub warehouse link is copied from the code=”https (the gitee code page is just above the code page) in the upper right corner of your own warehouse.
  • Method 2 creates a brand new repository:
    • ① Create a project location: Create a new project folder in an appropriate location on the computer, enter the folder, right-click and select git bash here
    • ② Initialize the git project: Enter git init in the interactive window, which means to initialize the git local warehouse. After execution, a hidden type folder of .git will be generated in the folder. (Dark) —" Note: If you can't see it, it means that the computer is not set to display hidden files (How to make the computer display hidden files by Baidu).
    • ③ Connect to the remote warehouse locally: enter git remote add origin + the address of your warehouse in the interactive window, such as https://github.com/wuzeweilml/212106739.git (212106739 is my warehouse name) Note: the above command means: add a remote source to the local repository. After executing this command, the interconnection between the local warehouse and the remote warehouse is completed.
      • The GitHub warehouse link is copied from the code=”https (the code page of gitee is just above the code page) in the upper right corner of your own warehouse. If you already have a connected warehouse, enter git remote rm origin first (delete the remote warehouse first, and proceed ③ A step of)
    • ④ Pull the code from the remote warehouse: git pull origin master —”Note: During the execution of the above command, you will be asked to enter the code cloud account and password for the first time. After the command is executed, you will see that the remote warehouse files are pulled to the local.
    • ⑤ Local synchronization (submission) to the remote warehouse:
      • git add . (The dot is also part of the command) Meaning: It means to add all unsubmitted files in the current folder to git, the dot means all, if you just add one, then use git add file name. Workspace = "temporary storage area
      • git commit -m "Enter your remarks here" (the quotation marks are part of the command) Meaning: It means to submit all the files in git, including files that have been submitted and modified, or files submitted for the first time. -m means remark. Temporary storage area = "resource library
      • git push origin master (branch name). Meaning: Push all submitted files to the master branch of the remote warehouse. Resource library = "remote warehouse

Replenish

  • git status View the status of all files
  • git status [specified file] View the status of the specified file
  • The files that need to be ignored during upload can be configured, and you can search for the method by yourself
  • Common commands for git branches
    • git branch lists all local branches
    • git branch -r lists all remote branches
    • git branch [branch] Create a new branch but still stay in the current branch
    • git checkout -b [branch] Create a new branch and switch to it
    • git checkout [branch] switch to this branch
    • git merge [branch] Merge the specified branch into the current branch
    • git branch -d [branch name] delete branch
    • git push origin --delete [branch name] delete remote branch
    • git branch -dr [remote/branch] delete remote branch

Supongo que te gusta

Origin blog.csdn.net/weixin_45113182/article/details/128777349
Recomendado
Clasificación