eget无法提交代码到远程仓库
2016-11-03 15:02
471 查看
Yesterday, I posted a question on how to clone a Git repository from one of
my machines to another,How
can I 'git clone' from another machine?.
I am now able to successfully clone a Git repository from my source (192.168.1.2) to my destination (192.168.1.1).
But when I did an edit to a file, a
I'm using two different versions of Git (1.7 on the remote and 1.5 on the local machine). Is that a possible reason?
I just had the same error while I began learning Git. Some of the other answers are clearly
not for someone new to Git!
(I am going to use non technical terms to get the idea across.) Anyway, what is happening is that you have two repositories, one is the original you first made, and the other the work one you just made.
Right now you are in your work repository and are using the "master" branch. But you also happen to be "logged in" in your original repository to the same "master" branch. Now since you're "logged in" in the original, Git fears you might mess up because you
might be working on the original and screw things up. So you need to return to the original repository and do a "git checkout someotherbranch", and now you can push with no problems.
I hope this helps.
http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked/
my machines to another,How
can I 'git clone' from another machine?.
I am now able to successfully clone a Git repository from my source (192.168.1.2) to my destination (192.168.1.1).
But when I did an edit to a file, a
git commit -a -m "test"and a
git push, I get this error on my destination (192.168.1.1):
git push hap@192.168.1.2's password: Counting objects: 21, done. Compressing objects: 100% (11/11), done. Writing objects: 100% (11/11), 1010 bytes, done. Total 11 (delta 9), reused 0 (delta 0) error: refusing to update checked out branch: refs/heads/master error: By default, updating the current branch in a non-bare repository error: is denied, because it will make the index and work tree inconsistent error: with what you pushed, and will require 'git reset --hard' to match error: the work tree to HEAD. error: error: You can set 'receive.denyCurrentBranch' configuration variable to error: 'ignore' or 'warn' in the remote repository to allow pushing into error: its current branch; however, this is not recommended unless you error: arranged to update its work tree to match what you pushed in some error: other way. error: error: To squelch this message and still keep the default behaviour, set error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. To git+ssh://hap@192.168.1.2/media/LINUXDATA/working ! [remote rejected] master -> master (branch is currently checked out) error: failed to push some refs to 'git+ssh://hap@192.168.1.2/media/LINUXDATA/working'
I'm using two different versions of Git (1.7 on the remote and 1.5 on the local machine). Is that a possible reason?
Answers
I just had the same error while I began learning Git. Some of the other answers are clearlynot for someone new to Git!
(I am going to use non technical terms to get the idea across.) Anyway, what is happening is that you have two repositories, one is the original you first made, and the other the work one you just made.
Right now you are in your work repository and are using the "master" branch. But you also happen to be "logged in" in your original repository to the same "master" branch. Now since you're "logged in" in the original, Git fears you might mess up because you
might be working on the original and screw things up. So you need to return to the original repository and do a "git checkout someotherbranch", and now you can push with no problems.
I hope this helps.
http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked/
相关文章推荐
- github提交代码无法改变远程仓库路径
- 02、eclipse创建远程仓库后无法提交代码,获取代码报错的解决方法
- Intellij IDEA 提交代码到远程GitHub仓库
- 【git】在git远程仓库中创建一个新项目并把本地代码提交上去
- git提交代码到多个远程仓库(github.com、git.oschina.net)
- 【Git】git将本地代码提交到远程仓库
- Git代码提交到CSDN远程仓库
- Intellij IDEA 提交代码到远程GitHub仓库
- Eclipse使用EGit插件 把本地代码提交到远程仓库
- git提交代码到本地仓库和远程仓库
- Eclipse使用EGit插件 把本地代码提交到远程仓库
- 本地代码提交到Git@OSC、github或其他远程仓库的方法
- git提交代码至远程仓库
- Intellij IDEA 提交代码到远程GitHub仓库
- eclipse中git插件无法向远程仓库提交tag的问题
- git第一次提交代码到远程仓库
- windows下使用GUI 把本地代码提交到git远程仓库
- windows下使用GUI 把本地代码提交到git远程仓库
- Myeclipse如何使用自带git工具向远程仓库提交代码
- Intellij IDEA 提交代码到远程GitHub仓库