“Yeah It’s on. ”
git基本操作
- clone到本地
- 修改/增加一个文件
$git add add.c #add/modify one file
$git commit -m “xxxx” #commit to local branch
$git status #check local status
$git push #push modification to remote server
问题
- 由于github仓库中提前建立readme文件,导致git push报错error: failed to push some refs to ‘[email protected]:
$ git push -u origin master
To [email protected]:xxx/xxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:xxx/xxx.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.
A:github远程仓库中README.md文件不在本地
方法1. $ git pull –rebase origin master
$ git push -u origin master
方法2. $ git push orign +master #强制push
命令
参考
- 2.
近期评论