新手常用的git命令及问题分析

本文提供了一套详细的Git使用教程,包括本地项目如何上传到GitHub、常见问题解决方案及如何从GitHub获取项目等内容,适合初学者快速掌握Git的基本操作。

git使用总结



最近喜欢上github,命令行果然简洁方便,决定总结一下自己的使用心得。(持续更新总结)

本地项目上传github

 git config --global user.name
 git config --global user.email
 cd d:
 mkdir bootstrap
 cd bootstrap 
 //初始化版本仓库
 git init
 //新建readme文件
 touch README
 //将所有文件添加到上传队列
 git add .
 //提交缓存,并添加描述‘first commit’
 git commit - m 'first commit'
 //注意需提前建立好版本仓库
 git remote add origin https://github.com/chne1218chen/bootstrap.git
 //提交到github仓库
 git push origin master

遇到问题

  • Q1
error:failed to push som refs to ......

解决方法:
1、先输入 git pull origin master ,先把远程服务器github上面的文件拉下来
2、再输入git push origin master
- Q2

fatal: remote origin already exists.

解决方法:
1、先输入 git remote rm origin
2、再输入git remote add origin https://github.com/chne1218chen/bootstrap.git 就不会报错了!

获取项目

git clone https://github.com/chne1218chen/bootstrap.git

文章更新,请点击这里查看,实战记录,适合新手使用哦

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值