将本地vue-cli3创建的项目关联到github远程仓库
2019-06-19 13:24
337 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_45266779/article/details/92828742
git init 初始化项目,如果是vue-cli3生成的项目,则跳过此步骤。
将本地的项目与远程仓库关联起来,remote-repository-address为远程仓库地址,可以去github去获取,然后执行
将项目提交到暂存区。
将项目提交到本地版本库。
将项目推送到远程仓库。
然后就可以愉快的
首先进入需要关联到远程仓库的项目文件夹中,执行如下命令:
1、
git init
git init 初始化项目,如果是vue-cli3生成的项目,则跳过此步骤。
2、
git remote add origin < remote-repository-address >
将本地的项目与远程仓库关联起来,remote-repository-address为远程仓库地址,可以去github去获取,然后执行
git remote -v查看是否关联成功。
3、
git add .
将项目提交到暂存区。
4、
git commit -m“提交描述”
将项目提交到本地版本库。
5、
git push origin master
将项目推送到远程仓库。
ps:问题来啦,当在执行第5步的时候可能会不成功,报如下错误
! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/#####/vue-project.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
大概意思就是更新被拒绝提示你应该
git pull一下,当执行
git pull origin master时,报错又来啦
fatal: refusing to merge unrelated histories,意思是拒绝合并不相关的历史。查阅了下资料,可以在git pull命令后加上–allow-unrelated-histories选项,问题就迎刃而解了,
git pull origin master --allow-unrelated-histories
然后就可以愉快的
git push origin master了,最后去github上刷新下看看是否有本地提交的项目。
相关文章推荐
- Git 创建github远程仓库并关联本地项目
- Git 菜鸟变大神 (四)Github 创建远程仓库以及关联本地仓库
- Git 菜鸟变大神 (四)Github 创建远程仓库以及关联本地仓库
- 【编程初学者】创建自己的开源项目4-将本地代码仓库的代码提交到远程代码仓库(myeclipse + github)
- Git学习第(二)篇:Git创建本地仓库并与GitHub远程仓库关联
- eclipse整合maven、git。eclipse创建maven项目然后创建本地git仓库并push到git远程仓库(github、gitlab、腾讯git、阿里git、公司内部git)
- 如何将一个本地项目和github远程仓库相关联并且使用户有push和fetch等权限
- Github上创建项目,并将本地项目上传到远程仓库的方法(使用git bash)
- 【编程初学者】创建自己的开源项目3-将远程代码仓库下载,并创建本地代码仓库(myeclipse + github)
- git-本地项目与关联到github创建的仓库上
- git拉取远程仓库项目并创建本地分支
- Android开源实战(二)如何在Github上创建仓库并与本地仓库关联
- 本地Git仓库关联到远程GitHub仓库
- 如何将本地项目变成git项目并关联远程仓库
- 本地Git仓库和远程仓库的创建及关联
- 如何创建github的repository,并和本地仓库关联
- GitHub 版本控制 项目托管 04 创建GitHub远程仓库
- 将vue-cli3生成的项目提交到GitHub新建仓库
- 本地Git仓库关联Github项目
- Github 创建仓库、上传本地项目图文教程