如何使用git连接GitHub以及git的常用命令

下载安装Git

配置用户名和邮箱

git config --global user.name "Your Name" 
git config --global user.email "Your Email"  

使用命令:git config --list 可查看当前用户信息以及其他的一些信息

查看用户名和邮箱

git config user.name
git config user.email

再GitHub上建立仓库

初始化仓库

git init

将项目的所有文件添加到缓存中

git add .

将缓存中的文件Commit到git库

git commit -m "添加你的注释,一般是一些更改信息"

将本地的库链接到远程仓库

地址为你GitHub上的仓库地址
git remote add origin https://github.com/Luo-Zhigang/my-mall.git

如果Git 提示fatal: remote origin already exists,可使用如下命令移除该仓库

git remote rm origin

然后重新连接后上传代码到远程仓库

git remote add origin https://github.com/Luo-Zhigang/my-mall.git
git push -u origin master
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值