git push 失敗

當要push的時候發生了一點錯誤….

[tdg@udnlap01 mail]$ git push -u 20141028 master
Enter passphrase for key '/home/tdg/.ssh/id_rsa':
To git@cowman.no-ip.org:udn/udn_mail_log.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@cowman.no-ip.org:udn/udn_mail_log.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

查看git status發現沒有問題

[tdg@udnlap01 mail]$ git status
# On branch master
nothing to commit (working directory clean)

執行rebase重新建立看看

[tdg@udnlap01 mail]$ git rebase 20141028
cannot rebase: you have unstaged changes
U       ftp.sh
M       ftp.sh

執行stash查看是什麼問題

[tdg@udnlap01 mail]$ git stash
ftp.sh: needs merge
ftp.sh: needs merge
ftp.sh: unmerged (7800202abc23a0e2d2702afd0e64f8ddec715bdf)
ftp.sh: unmerged (0e2f9d79c3e70028002bfa920d47c39b37ddbb9c)
fatal: git-write-tree: error building trees
Cannot save the current index state

選擇本低端的版本

[tdg@udnlap01 mail]$ git checkout --ours ftp.sh

後面就一般動作推上去了

[tdg@udnlap01 mail]$ git add ftp.sh
[tdg@udnlap01 mail]$ git commit -m "修正mailerd無動作、加入SSH&SCP "
[master 76eedce] 修正mailerd無動作、加入SSH&SCP
[tdg@udnlap01 mail]$ git push -u 20141028 master
Enter passphrase for key '/home/tdg/.ssh/id_rsa':
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.03 KiB, done.
Total 4 (delta 3), reused 0 (delta 0)
To git@cowman.no-ip.org:udn/udn_mail_log.git
   d5b4793..76eedce  master -> master
Branch master set up to track remote branch master from 20141028.
This entry was posted in Git. Bookmark the permalink.