把本地项目推送到github的命令
来源:互联网 发布:python 接收上传图片 编辑:程序博客网 时间:2024/06/06 01:55
首先你要登录github新建一个仓库,记录下这个仓库的地址,地址一般是: https://github.com/username/repositoryname.git/
仓库建立完毕后,这时候就需要用我们之前安装的git命令来将本地的代码推送到github上了。如果你仅为了展示自己的前端页面,那么只要掌握如下命令即可(不熟悉git命令的可以参考git - 简易指南):
(1)打开你的目录
cd demo
(2)初始化版本库,用于生成git文件
git init
(3)将所有文件添加到缓存区
git add *
(4)提交当前工作空间的修改内容
git commit -m "first commit"
(5)将仓库连接到远程服务器
git remote add origin <server>(就是上面你仓库的地址)
(6)将改动推送到所添加的服务器上
git push -u origin master
在推送的时候我出现了错误如下:
warning: redirecting to https://github.com/kellywang1314/dabai.git/To http://github.com/kellywang1314/dabai.git ! [rejected] master -> master (fetch first)error: failed to push some refs to 'http://github.com/kellywang1314/dabai.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (e.g., 'git pull ...') before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.
查了一下错误的原因是github中的README.md文件不在本地代码目录中。所以我们把上面第六步分成两步:
git pull --rebase origin master:进行代码合并git push -u origin master
阅读全文
0 0
- 把本地项目推送到github的命令
- 本地代码推送到github的命令
- 把项目推送到github
- Git-最简单的本地项目变成版本仓库,然后把内容推送到GitHub仓库
- Git-最简单的本地项目变成版本仓库,然后把内容推送到GitHub仓库
- 使用Git命令把本地项目上传到Github托管
- 使用Git命令把本地项目上传到Github托管
- 使用Git命令把本地项目上传到GitHub托管
- 使用Git命令把本地项目上传到Github托管
- 将本地的git项目推送到gitHub中的操作
- Git 将本地项目推送到Github
- 把自己创建在本地的项目提交到github
- 如何把本地项目上传到github
- 把本地项目提交到 github 上
- 把本地项目上传到Github仓库
- 如何把本地项目上传到Github
- 把本地项目上传到Github
- 把本地项目上传到github中
- poj 1573 Robot Motion 模拟
- HDU1005
- Ubuntu安装navicat
- 单链表的插入,查找,删除
- rpm&&yum
- 把本地项目推送到github的命令
- 解决IDEA乱码问题
- JVM垃圾回收机制
- 【Android笔记】dump audio数据定位音频问题
- 808B
- Angular2-Bootstrap的继承
- SSL certificate problem: self signed certificate
- SDNU 1147 Pythagoras's Revenge 【技巧暴力】
- 大数据竞赛平台——Kaggle 入门篇