Manage remote gitee warehouses through git (push, pull)

Manage remote gitee warehouses through git (push, pull)

Git: is a distributed version control system used to track and manage source code and files of software development projects. It can record the modification history of files, allow multiple people to work together, and provides functions such as undoing changes, branch management, and merging code.
Git was originally developed by Linus Torvalds to manage the source code of the Linux kernel. It has become a widely used version control system, not just for software development, but for any project that needs to track and manage file versions.
Unlike centralized version control systems such as SVN, Git is a distributed version control system. This means that each developer can have a complete copy of the project, including the full history. This distributed nature allows developers to work locally without always being connected to a central server.
With Git, developers can easily switch branches, merge code, view and compare different versions of files, and roll back to previous versions. It also provides powerful collaboration features, allowing multiple people to work on the same project at the same time, and can share and coordinate code through remote warehouses.
Git uses a command-line interface, but there are also many graphical user interface tools available to simplify operations. It has wide support in the open source community and has become the version control system of choice for many development teams.

  1. Create a new warehouse in gitee
  2. Add username and email in Git
git config --global user.name “username”
git config --global user.email [email protected]
# 查看是否创建成功
git config --list

3.Git generates SSH public key

ssh-keygen -t rsa -C *[email protected]*
在C:\Users\Administrator.ssh目录中自动生成公钥和私钥文件。

insert image description here
4. Add public key in Gitee

  • Open id_rsa.pub with Notepad, and select all to copy.
  • Log in to gitee, open the settings, paste the copied content here, confirm the title and click Save.
    insert image description here

5. Manage the gitee warehouse

  • init initializes the local warehouse

    git init 
    
  • clone clone remote repository

    # Gitee仓库URL 如下图所示
    git clone [email protected]:<Gitee仓库URL>
    

    insert image description here

  • add Add your files to the Git staging area

    # 这将添加当前目录下的所有文件到暂存区。如果你只想添加特定的文件,可以使用git add <文件名>命令。
    git add .
    
  • commit Submit your files (temporary storage area) to the local warehouse

    # Initial commit 自行定义
    git commit -m "Initial commit"
    
  • push Submit the local warehouse to the remote warehouse

    git push -u origin master
    
  • pull Pull the remote warehouse to the local warehouse

    git pull origin master
    
  • Associate the local repository with the Gitee repository:

    git remote add origin <Gitee仓库URL>
    

Guess you like

Origin blog.csdn.net/qq_38393271/article/details/131654129
Recommended