対処法以前に英語が読めない。
現象
gitでpushしようとしたら以下エラー。
error: failed to push some refs to 'git@github.com.pylangstudy:pylangstudy/201705.git' ヒント: Updates were rejected because the remote contains work that you do ヒント: not have locally. This is usually caused by another repository pushing ヒント: to the same ref. You may want to first integrate the remote changes ヒント: (e.g., 'git pull ...') before pushing again. ヒント: See the 'Note about fast-forwards' in 'git push --help' for details.
- 翻訳%20before%20pushing%20again.%0A%E3%83%92%E3%83%B3%E3%83%88%3A%20See%20the%20%27Note%20about%20fast-forwards%27%20in%20%27git%20push%20--help%27%20for%20details.)
参考
http://hacknote.jp/archives/15275/
感謝。
ローカルがサーバより古いのが原因らしい。pullでローカルを最新にしてから再度pushするといけると。
$git pull origin master
なぜ古くなったのか。そういえばサイト側でReadMeのちょっとした修正をした。あのときにローカルが古くなったのだろう。
やってみた
$git pull origin master
GNU nano 2.2.6 ファイル: ...ython/pylangstudy/201705/.git/MERGE_MSG Merge branch 'master' of github.com.pylangstudy:pylangstudy/201705 # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
MERGE_MSG
から察するに「マージ」するから「メッセージ」を書けということなのだろう。Gitの機能を未だに理解していない。しかもGNU nanoというテキストエディタの画面になって混乱する。普段使っていないから。Ctrl+Xキーで終了すれば先に進んだ。
remote: Counting objects: 4, done. remote: Compressing objects: 100% (4/4), done. remote: Total 4 (delta 2), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (4/4), done. From github.com.pylangstudy:pylangstudy/201705 * branch master -> FETCH_HEAD 13182d9..f62a12f master -> origin/master Merge made by the 'recursive' strategy. "25/Python\345\255\246\347\277\222\346\226\271\351\207\235.md" | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
所感
Gitについて根本的にわかっていない。こんなんでIssueを使いこなせるだろうか。Branchもいまだにmasterだけ使っているし。でもワークフローは複雑にしたくない。Python学習の前にGit学習が必要になってしまい前進できないから。