2017-05-22 27 views
0

在開發我有2個分支機構Git的開關文件:不能推

$ git branch 
    dev * 
    master 

我已經從開發做

$ git checkout master 
$ git checkout dev <file path> 

當我複製文件到主分支試圖提交該文件

[email protected]:~/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) 

然後

[email protected]:~/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

請仔細閱讀git輸出,特別是以Permission denied開頭的最後兩段落 – AlexD

+0

是的,但是我以root身份登錄@AlexD –

+0

您需要確保您的本地用戶root可以訪問您嘗試推送的遠程存儲庫至 – AlexD

回答

0

好像你有一個權限問題,要河畔嘗試使用HTTPS URL,而不是避免處理SSH公鑰認證的SSH URL。
這樣做,你需要通過設置
[remote "origin"] url = <ssh remote>
通過

[remote "origin"] 
    url = https://<https remote> 

修改的.git/config中的配置文件,然後嘗試一個簡單的

git push origin master 
1

顯示錯誤消息2信息:

  1. 第一個是一場漫長的戰爭寧關於推命令
  2. 選擇第二個說,拒絕「權限」,而且是實際的原因,你推不成功

要解決1:
你可能想使用simple選項默認。在您的終端中鍵入一次:

git config --global push.default simple 

而且這種冗長的警告應該消失。
(有關詳細信息,你可以閱讀git help push詳細描述)

要解決2:
你說你登錄爲根,所以你可能不會使用正確的SSH密鑰。如果您知道您在遠程服務器上上傳並安裝了個人帳戶的公鑰,請嘗試從您的個人帳戶運行git push