做个记录备份也给其他的道友一个指引,若有错误请联系我一起讨论,谢谢!
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
这个步骤成功之后 再继续第八步则可以成功上传项目了