提交时出现下面错误
harriszh Sat 14:13@ ~/trunk/vpi$ git push -u origin master
To [email protected]:zhuzhzh/vpiIntro.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:zhuzhzh/vpiIntro.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.
在提交时,在github上已经有了一个LICENSE的文件 需要把github上的内容先合并才能提交
$ git fetch origin
$ ls
ex1 ex2 ex3 ex4 ex5 README.md
$ git merge origin/master
Merge made by recursive.
LICENSE | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
create mode 100644 LICENSE
harriszh Sat 14:25@ ~/trunk/vpi$ git status
# On branch master
nothing to commit (working directory clean)
$ ls
ex1 ex2 ex3 ex4 ex5 LICENSE README.md
$ git push origin master
Counting objects: 48, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (47/47), 10.75 KiB, done.
Total 47 (delta 9), reused 0 (delta 0)
remote: Resolving deltas: 100% (9/9), done.
To [email protected]:zhuzhzh/vpiIntro.git
70b72f6..b90a785 master -> master
如果安装git后没有设置用户名和email地址,还需要先执行
git config --global user.name "harriszh"
git config --global user.email "[email protected]"