在开发中我有2个分支
$ git branch
dev *
master
我已经通过
将文件从dev复制到master分支 $ git checkout master
$ git checkout dev <file path>
当我试图提交该文件时
root@magento:~/abc.sg/magento# git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
然后
root@magento:~/abc.sg/magento# git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
当我运行日志时,它会显示
* 4b471cd - (10 minutes ago) WIP on master: b937e71 Text - Text (refs/stash)
我以root身份登录
答案 0 :(得分:1)
错误消息显示2个信息:
修复1.:
您可能希望默认使用simple
选项。在终端中键入一次:
git config --global push.default simple
这个冗长的警告应该消失
(有关详细信息,请阅读git help push
)
修复2.:
你说你以root身份登录,所以你可能没有使用正确的ssh密钥。如果您知道您在远程服务器上上传并安装了个人帐户的公钥,请尝试从您的个人帐户运行git push
。
答案 1 :(得分:0)
似乎您有权限问题,尝试使用HTTPS URL而不是SSH URL来避免处理SSH公钥验证。
为此,您需要通过设置
来修改.git / config中的配置文件
[remote "origin"]
url = <ssh remote>
通过
[remote "origin"]
url = https://<https remote>
然后尝试一个简单的
git push origin master