将项目添加到git上的步骤

做个记录备份也给其他的道友一个指引,若有错误请联系我一起讨论,谢谢!

1、在git 上创建项目的仓库

2、在终端中进入本地项目文件夹中 

命令行 :cd 你的工程文件

3、初始化 git

命令行: git init

4 、 命令行:git add .

5、配置账号信息

命令行:

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

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



6、 上传日志

命令行:git commit -m "first commit"

7、添加远程git库地址

命令行:git remote add origin 项目仓库地址

8、上传项目

命令行:git push origin master

 到这个本地项目就已经上传到git上了


若步骤8出现问题 问题如下


 ! [rejected]        master -> master (fetch first)

error: failed to push some refs to 'gitxxxxxxxxxxxxxxx.git'

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.


解决办法

9、上传本地缓存

命令行: git pull origin master

这个步骤成功之后 再继续第八步则可以成功上传项目了







  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值