上传本地项目代码到Gitee或Github

1、登录Gitee创建一个与项目名字相同的仓库,如book
在这里插入图片描述
2、打开Git命令窗口Git Bash
在这里插入图片描述
3、切换到项目的目录,如E:\workspace\mybatis-spring\book
在这里插入图片描述
4、执行以下命令

# 1、初始化
$ git init
Initialized empty Git repository in E:/workspace/mybatis-spring/book/.git/
# 2、添加远程仓库
$ git remote add origin https://gitee.com/moss_huang/book.git

# 3、同步远程仓库到本地仓库
$ git pull origin master
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From https://gitee.com/moss_huang/book
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

# 4、添加要上传的文件到缓存区
$ git add . 或者 git add + 文件名
warning: LF will be replaced by CRLF in book.sql.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in logs/book.log.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main/webapp/WEB-INF/js/bootstrap.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in src/main/webapp/WEB-INF/js/jquery-3.3.1.min.js.
The file will have its original line endings in your working directory

# 5、上传代码到本地仓库
$ git commit -m '测试上传代码'

# 6、将本地仓库推送到远程仓库
$ git push origin master
Enumerating objects: 66, done.
Counting objects: 100% (66/66), done.
Delta compression using up to 4 threads
Compressing objects: 100% (49/49), done.
Writing objects: 100% (65/65), 81.20 KiB | 2.54 MiB/s, done.
Total 65 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-3.8]
To https://gitee.com/moss_huang/book.git
   dd98d95..389971a  master -> master

5、刷新Gitee就可以看到提交的项目了
在这里插入图片描述

  • 14
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值