将本地代码库推送到gitHub中
来源:互联网 发布:淘宝男士休闲鞋2015款 编辑:程序博客网 时间:2024/05/13 01:50
在本地项目所在目录按以下步骤操作
git init git add .--添加本文件夹所有文件到暂存区 git commit -m "init" git remote add origin git@github.com:dengzhaotai/vlc_play.git--origin是给远程起的别名 git push -fu origin master--参数f的作用是强行将本地代码推送到远程
如果第四步出现了以下问题
Administrator@USER-20140819FI /d/git_dir/git_play_repo (master)$ git remote add origin git@github.com:dengzhaotai/vlc_play.gitfatal: remote origin already exists。
解决办法如下:
1、先输入$ git remote rm origin
2、再输入$ git remote add origin git@github.com:dengzhaotai/vlc_play.git 就不会报错了!
在第五步中,如果想要将本地的master分支推送到远程指定的分支的方式
$ git push <远程主机名> <本地分支名>:<远程分支名>例如:git push -fu origin master:microdsy--将本地的master分支强行推送到远程的microdsy分支
non-fast-forward后的冲突解决
当要push代码到git时,出现提示:
error:failed to push some refs to ...
Dealing with “non-fast-forward” errors
From time to time you may encounter this error while pushing:
- $ git push origin master
- To ../remote/
- ! [rejected] master -> master (non-fast forward)
- error: failed to push some refs to '../remote/'
一、强推 加-f参数
二、
先把git的东西fetch到你本地然后merge后再push
$ git fetch
$ git merge
这2句命令等价于- $ git pull
可是,这时候又出现了如下的问题:
上面出现的 [branch "master"]是需要明确(.git/config)如下的内容[branch "master"]
remote = origin
merge = refs/heads/master
这等于告诉git2件事:1,当你处于master branch, 默认的remote就是origin。
2,当你在master branch上使用git pull时,没有指定remote和branch,那么git就会采用默认的remote(也就是origin)来merge在master branch上所有的改变如果不想或者不会编辑config文件的话,可以在bush上输入如下命令行:
- $ git config branch.master.remote origin
- $ git config branch.master.merge refs/heads/master
之后再重新git pull下。最后git push你的代码吧。
0 0
- 将本地代码库推送到gitHub中
- 将本地代码上传到github中
- git将本地仓库推送到github
- Git 将本地项目推送到Github
- 【Git学习笔记】GitHub中创建仓库,将本地仓库推送到远程库
- GitHub推送本地代码到仓库
- 本地代码推送到github的命令
- 如何将本地代码上传到github中
- 如何将本地代码上传到GitHub
- 将本地代码上传到github
- 将本地代码上传到github
- 将本地代码托管到github
- 将本地代码上传到github
- 将本地git仓库推送到github上
- 将本地git仓库推送到github上
- 将本地git仓库推送到github上
- git(一) 将本地项目推送到github上
- 将本地的git项目推送到gitHub中的操作
- openresty+consul动态配置更新(服务变更发现)
- 欢迎使用markdown编辑器
- adb 常用命令
- laravel 学习笔记二 :配置
- 从本地数据库查询全国省市县信息
- 将本地代码库推送到gitHub中
- 图片验证码
- 悬浮指示器布局-自定义控件
- 设置浏览器允许跨域访问
- struts中submit标签传递参数问题
- 在pom.xml文件中配置嵌入式tomcat运行j2ee项目
- Android仿“守望先锋”加载动画
- bShare分享插件的使用
- leetcode facebook 面试题 Merge two interval lists