提交已有项目到GitHub
来源:互联网 发布:淘宝客服每日工作总结 编辑:程序博客网 时间:2024/04/29 10:41
1、在GitHub上创建和本地项目的同名Repository
2、在你本地已有项目的根目录中打开Git Bash Here,使用命令$ git remote add origin xxx.git
关联本地库和GitHub远程库。(如果报错:fatal: Not a git repository (or any of the parent directories): .git
,那么可以先执行命令:git init
)
3、将本地项目文件添加到本地缓存库和提交到本地分支,命令如下:
$ git add . //将所有的本地文件提交到缓存中;后面的 . 代表所有文件;$ git commit -m "提交信息..." //将所有文件提交到本地库中
4、提交本地代码到远程库,命令如下:
$ git push -u origin master //第一次提交添加命令参数 -u 确保关联本地库和远程库$ git push origin master //非第一次提交使用此命令即可
5、最后打开github网站,看看你的Repository代码有没有提交成功。成功之后你会发现你本地项目的目录下多了几个文件,然后把.mvn、mvnw和mvnw.cmd这三个文件(IDEA新建项目时默认创建的)都删掉。
报错
我在执行
$ git push -u origin master
命令的时候报错:To git@github.com:xxx/xxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:xxx/xxx.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.
,原因是没有同步远程的master,所以需要先执行命令git pull origin master
同步代码,这里需要注意的一点是执行命令git pull origin master
之后会进入编辑器界面,然后提示要输入什么git message,但是我一直不知道怎么输入,百度之后也没有结果,后来我自己乱搞给解决了。我的解决方法是进入编辑器界面后先按INSERT键进入编辑模式,然后把编辑器里面的内容全部删除,再输入你的什么信息,最后按esc进入vim模式,再输入:quit命令退出编辑器(如果执行:quit命令报错:E37: No write since last change (add ! to override)
,原因是文件为只读文件,无法修改,使用命令:w!强制存盘即可),问题解决……everything up-to-date git push
解决方法:http://www.tuicool.com/articles/zeaQjavType :quit to exit Vim
解决方法:https://zhidao.baidu.com/question/1383974964482632100.html
参考:http://www.cnblogs.com/springlight/p/6282152.html
参考:http://www.cnblogs.com/jun1019/p/6243295.html
- 提交已有项目到GitHub
- 提交本地已有项目到GitHub
- linux命令行将已有项目提交到github
- linux命令行将已有项目提交到github
- 添加已有项目到github
- 提交项目到gitHub
- 提交项目到github
- 如何添加一个已有项目到GitHub
- linux上传本地已有项目到github
- 从本地更新已有项目到github
- eclipse提交项目到github
- eclipse提交项目到github
- Git提交项目到Github
- eclipse提交项目到github
- eclipse提交项目到github
- eclipse提交项目到github
- eclipse提交项目到github
- 将项目提交到github
- Codeforces Round #376 (Div. 2) D. 80-th Level Archeology —— 差分法 + 线段扫描法
- PhpStorm+Xampp+Xdebug配置
- 博客连接
- unity3d防止材质贴图丢失解决办法
- java中enum的用法总结
- 提交已有项目到GitHub
- 多线程-多线程常见的面试题
- 有十个台阶,一步或两步走,上楼梯有几种上法?
- 对象的赋值与对象的复制
- Centos 7 安装 Jenkins
- 如何求系统时间
- 调优(一)
- java.lang.System
- Sax解析文档的用法演示