How to use git to upload files to Github remote warehouse (complete and detailed process)

1. Download Git on your computer

Download from git official website: Git - Downloads (git-scm.com)

insert image description here

Just download and install.

2. Configure Git

Right mouse button to enter the Git command line

(1) Set the user name and set the user account (need to be your own registered Github account)

git config --global user.name "user_name"#(自己的用户名)
git config --global user.email "[email protected]"(自己Github账号邮箱)

(2) Configure password-free login (your own Github account mailbox)

ssh-keygen -t ed25519 -C "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"

Enter directly

insert image description here

Then C:\Users\【用户名】\.ssh\id_rsa.pubuse Notepad to open id_rsa.pubthe file, select all to copy the content inside, and then open your own Github

insert image description here

3. Upload the Github repository

Create a new warehouse

insert image description here

image-20230426095151778

There is also an example of uploading a file here
insert image description here

The local Git submission is used here, and the steps are as follows:

image-20230426100014493
img

#到对应的文件夹下,鼠标右键打开Git的命令窗口
#1.先初始化
git init
#2.添加所有文件至暂存区
git add .
#3.提交本地仓库
git commit -m "first commit"
#4.设置分支
git branch -M main
#5.本地仓库和远程仓库建立连接
git remote add origin https://github.com/QHCV/flask.git
#6.提交远程仓库
git push -u origin main

insert image description here

image-20230426100526641
Submitted successfully
insert image description here

Guess you like

Origin blog.csdn.net/QH2107/article/details/130380139