github初体验之上传项目

  1. 创建一个自己的github账户
    在这里插入图片描述
  2. 创建一个仓库
    在这里插入图片描述创建完成后会有一个ssh链接,在接下来的操作中会使用到
    在这里插入图片描述
  3. 下载最新的Git,下载地址为https://git-scm.com/downloads,安装完成后打开Git Bash,开始上传项目
    在这里插入图片描述
  4. 进入想要上传的项目目录
Administrator@SC-201906171616 MINGW64 ~
$ cd D:
Administrator@SC-201906171616 MINGW64 /d
$ cd  IdeaProject/
Administrator@SC-201906171616 MINGW64 /d/IdeaProject
$ cd chatRoom/
  1. 输入git init
    在项目中生成本地git管理
Administrator@SC-201906171616 MINGW64 /d/IdeaProject/chatRoom
$ git init
Initialized empty Git repository in D:/IdeaProject/chatRoom/.git/
  1. 输入git add .
    将项目中的所有文件加入到仓库中,如果想要加入特定文件,将 . 换成特定文件名即可
Administrator@SC-201906171616 MINGW64 /d/IdeaProject/chatRoom (master)
$ git add .
  1. 输入git commit -m “first commit”
    表示你对这次提交的注释,双引号里面的内容可以根据个人的需要改。
Administrator@SC-201906171616 MINGW64 /d/IdeaProject/chatRoom (master)
$ git commit -m "first commit"

如果出现以下这种情况

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'Administrator@SC-201906171616.(none)')

使用git config --global user.email "you@example.com"命令,设置github账户
再输入git commit -m "first commit"时就会成功

  1. 输入git remote add origin https://自己的仓库url地址(上面有说到) 将本地的仓库关联到github上

Administrator@SC-201906171616 MINGW64 /d/IdeaProject/chatRoom (master)
$ git remote add origin https://github.com/muliming/chatRoom.git

11.输入 git push -u origin master,
将文件上传到github上,执行完成后会跳出登陆框,输入自己的账户密码即可。

Administrator@SC-201906171616 MINGW64 /d/IdeaProject/chatRoom (master)
$ git push -u origin master
Fatal: HttpRequestException encountered.
Username for 'https://github.com': muliming
Counting objects: 1069, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1054/1054), done.
Writing objects: 100% (1069/1069), 4.06 MiB | 648.00 KiB/s, done.
Total 1069 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
To https://github.com/muliming/chatRoom.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值