如何使用git上传文件到Github远程仓库(完整详细流程)

您所在的位置:网站首页 github上传文件到别人的仓库上 如何使用git上传文件到Github远程仓库(完整详细流程)

如何使用git上传文件到Github远程仓库(完整详细流程)

2024-03-04 22:52| 来源: 网络整理| 查看: 265

文章目录 1.在电脑上下载Git2.配置Git3.上传Github仓库

1.在电脑上下载Git

git官网下载:Git - Downloads (git-scm.com)

在这里插入图片描述

下载后安装即可。

2.配置Git

鼠标右键进入Git命令行

(1)设置用户名和设置用户账号(需要是自己的注册Github账号)

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

(2) 配置免密登录(自己Github账号邮箱)

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

直接回车

在这里插入图片描述

然后在C:\Users\【用户名】\.ssh\id_rsa.pub中使用记事本打开id_rsa.pub文件,全选复制里面的内容,然后打开自己的Github

在这里插入图片描述

3.上传Github仓库

新建一个仓库

在这里插入图片描述

image-20230426095151778

这里面也有上传文件的示例 在这里插入图片描述

这里使用本地Git提交,步骤如下:

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

在这里插入图片描述

image-20230426100526641 提交成功 在这里插入图片描述



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3