git本地仓库首次push到远程仓库出现错误 ! [rejected] master -> master (fetch first)
2016-08-26 14:23
721 查看
新建好本地的仓库和远程仓库之后,
经过
然后
最后想推送到远程仓库的时候
出现下图错误
错误详情:
解决很简单,使用强制推送
使用下面的命令
经过
git add .
然后
git commit -m "......"
最后想推送到远程仓库的时候
git push -u origin master
出现下图错误
错误详情:
! [rejected] master -> master (fetch first) error: failed to push some refs to 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.
解决很简单,使用强制推送
使用下面的命令
git push -f origin master
附上git push 的说明
NAME git-push - Update remote refs along with associated objects SYNOPSIS git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>] [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose] [-u | --set-upstream] [--[no-]signed|--sign=(true|false|if-asked)] [--force-with-lease[=<refname>[:<expect>]]] [--no-verify] [<repository> [<refspec>…]] -f --force Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Also, when --force-with-lease option is used, the command refuses to update a remote ref whose current value does not match what is expected. This flag disables these checks, and can cause the remote repository to lose commits; use it with care. Note that --force applies to all the refs that are pushed, hence using it with push.default set to matching or with multiple push destinations configured with remote.*.push may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the<refspec>... section above for details.
相关文章推荐
- git 使用以及 部分错误 [rejected] master -> master (fetch first)(non-fast forward)
- git提交远程报错[rejected] master -> master (fetch first)
- push 出现问题 master -> master (fetch first)
- git ! [rejected] master -> master (fetch first)
- git 本地push错误,导致远程仓库版本错误
- git 报错 git [rejected] master -> master (fetch first)(non-fast forward) 的解决方法
- IDEA使用Git出现push to origin/master was rejected错误解决方案
- git ! [rejected] master -> master (fetch first)
- Git Push 错误 [remote rejected] master -> master (branch is currently checked out) & 无法查看push后的git中文件
- 在Linux服务器上搭建Git远程仓库并Push本地库
- git push 代码到远程仓库错误1
- git fetch 的简单用法:更新远程代码到本地仓库
- Git Push 错误 [remote rejected] master -> master (branch is currently checked out) & 无法查看push后的git中文件(转)
- git push origin master、git pull出现如下错误
- git 新增远程仓库并拉取更新至本地master
- git pull取得远程仓库的对像并刷新、合并本地数据git fetch+get merge
- 使用Git的Push出现rejected - non-fast-forward错误
- $ git push origin test:master // 提交本地test分支 作为 远程的master分支
- 【git fetch】的简单用法:更新远程代码到本地仓库
- git push origin master、git pull出现如下错误