Gitee/Github submits local project code to remote warehouse

Use Git tools, download and install from Git 2.30.1 official website , please refer to the Git download and installation configuration tutorial , or do not refer to the download and installation tutorial, brute force installation, all the installation process chooses the default or Recommended (recommended) options.

After Git is downloaded and configured, desktop >> right mouse button >> Git Bash Here

first step

global configuration

$ git config --global user.name "你的名字-随便"
$ git config --global user.email "你的邮箱"
$ git config --global user.password "你的密码"

Here it can be set to be consistent with Github / Gitee, and you $ git config --listcan view the configured information with .

After configuration, you can close Bash, or you can CD to the local warehouse by yourself, and then perform follow-up operations.

second step

Create a repository on Gitee / Github
Create warehouse

third step

Upload project code

method one

Create a Gitee/Github warehouse first, modify/add files, and push to the Gitee/Github warehouse.

Take Gitee as an example

  1. Initialize the local warehouse, that is, create the .git folder (hidden) locally
    . The address Url used in it can be found on the warehouse page, as shown in the figure.
    copy Link
    Key steps:
    create a new folder, under this folder, right mouse button >> Git Bash Here >> enter the following Bash command
    $ git init 
    $ git remote add origin https://gitee.com/用户个性地址/HelloGitee.git # 复制来的链接
    $ git pull origin master # 复制远程仓库文件到本地目录
    
  2. In the newly created folder, copy and paste the items to be uploaded, which can be one or more folders.
    $ git add . #将当前目录所有文件添加到git暂存区
    $ git commit -m "文件描述-随便" #提交并备注提交信息
    $ git push origin master #将本地提交推送到远程仓库
    

Done!

Method 2 (recommended)

First clone the Gitee/Github warehouse to the local, and then push to the Gitee/Github warehouse after modification.
This method can save all your existing files, READNE.md is very important.
Basically the same as Method 1.

  1. Create a new folder, under this folder, right mouse button >> Git Bash Here >> enter the following Bash command.
    $ git clone https://gitee.com/用户个性地址/HelloGitee.git #将远程仓库克隆到本地
    
  2. After cloning, enter the warehouse folder (subfolder), copy and paste the items to be uploaded, which can be one or more folders.
    $ git add . #将当前目录所有文件添加到git暂存区
    $ git commit -m "文件描述-随便" #提交并备注提交信息
    $ git push origin master #将本地提交推送到远程仓库
    

Done!


when you can't pay

$ git push -u origin master -f 

Basically solves most problems, but problems may occur.

Guess you like

Origin blog.csdn.net/qq_32301683/article/details/114106665