使用Git向Gitee仓库推送项目的完整流程
1.安装git
如果没有特殊需求,直接下一步即可;安装链接如下:Git - Downloads (git-scm.com)
2.在Gitee上新建仓库,初始化仓库
3.保存仓库的链接,如下图标记所示


4.在需要推送的项目文件夹中右键选择 “Open Git Bash here”

5.初始化git,使用的命令如下
git init

初始化成功后,项目文件夹下会出现一个 .git 的文件夹(该文件夹为隐藏文件夹,需要在文件资源管理器-查看-√隐藏的项目),如下图所示

6.将项目文件夹与仓库进行关联,这里需要用到步骤3中的仓库链接,下面是我测试时用到的链接
git remote add origin https://gitee.com/yangbe1/test-push-to-gitee.git
7.从远程仓库的master分支拉取文件到本地
git pull origin master


8.提交项目文件,用到的指令如下
git add .
git commit -m "Test Push"
git push origin mastery
由于是第一次提交,在第二行命令执行时提示我确认身份(邮箱和姓名)

在.git文件夹下的config文件中添加 user 姓名和邮箱即可(下面仅为示例)
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[user]
email=16249@q.com
name=yb
[remote "origin"]
url = https://gitee.com/yangbe1/test-push-to-gitee.git
fetch = +refs/heads/*:refs/remotes/origin/*
由于是第一次提交,在执行第三步时,需要确认git凭证,即Gitee登录时的用户名和密码

提交成功,提交的状态可以在仓库中查看

热门相关:资本大唐 明朝败家子 影帝偏要住我家 奈何老公太宠我 甜蜜隐婚:老公大人,宠上瘾