GitHub基本提交操作

1.在网页版的GitHub下新建仓库
然后

git clone (你的仓库名git@github.com:xxx/xxx.git

2.在GIT bash终端使用 cd 命令切换进clone的目录
此时可以使用git status看下情况,当然,啥也木有

On branch master

Initial commit

nothing to commit (create/copy files and use "git add" to track)

3.这里,初始化一下仓库

git init

4.然后把文件夹中你要添加的东西,使用

git add xxx

5.可以建一个readme.md,markdown格式的文件,使用touch命令

touch README.md

6.将文件加入暂存区,然后使用git commit,-m后的是提交信息,是对本次提交的概述

git commit -m "this is a demo,you can say whatever you'd like to say"

不加-m的话,会弹出一个vi编辑器界面,注意把要说的话在写进去,去除#即可,否则不生效
提交好了可以通过git log 看下日志

7.push
到上一步,GitHub上的仓库还木有被更新,此时需用push命令

git push

Done
坑:
如果clone到一个空仓库,开始不init的话,后面会提示你

*** 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: empty ident name (for <(NULL)>) not allowed

这时候可能即使你运行这两行了,也没反应。
解决方法是到你这个文件夹的目录,win的话打开隐藏的.git文件夹,config这个文件打开,加入

[user]
name=yourname
email=youremail

就好了。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值