Git遠程庫操作遇到的一些問題

一、問題:執行git remote add origin [email protected]:yylxm/Git.git

                    出現問題fatal: remote origin already exists.

        解決辦法:git remote顯示所有的遠程庫,然後採用git remote rm origin刪除該origin。


二、問題: 採用git push -u origin master推送本地庫到github
                   出現問題fatal: I don't handle protocol 'git@https'

       解決辦法:採用git remote add origin http://github.com:yylxm/Git.git,Git.git是在github上創建的repositories 。


三、問題:執行$ git push -u origin master
                   出現問題 Username for 'https://github.com': yylxm
                                    To https://github.com/yylxm/YYXQZ.git
                                     ! [rejected]        master -> master (fetch first)
                                    error: failed to push some refs to 'https://github.com/yylxm/YYXQZ.git'
                                    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.

      解決辦法:錯誤的主要原因是github中的README.md文件不在本地代碼目錄中,

                         可以通過如下命令進行代碼合併【注:pull=fetch+merge】 git pull --rebase origin master

                         再通過命令git push -u origin master完成代碼上傳到github的操作。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章