git 本地文件修改以后上传同步到 github 仓库中
Git local file modified after uploading synchronization to github repository
更新上传过程中,提示: Everything up-to-date 说未进行任何更新。
1、执行更新
- git add *
1.1、如果只需要更新单个文件
- git add example.txt
1.2、更新文件中包含空格,加引号
- git add 'example abc.txt'
2、填写变更注释
- git commit -m "Enter commit message here--这里写注释"
3、推送「push」到仓库中
其中 origin 为仓库起初起的名称,默认 origin 。
- git push origin master
3.1、如果提示
- To https://github.com/xxx/xxxxx
- ! [rejected] master -> master (fetch first)
- error: failed to push some refs to 'https://github.com/xxx/xxxx'
- 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.
表示线上的版本比本地的新。需要下载「pull」线上的最新版更新到本地。
- git pull origin master --allow-unrelated-histories
3.2、如果提示
- fatal: AggregateException encountered.
- Username for 'https://github.com': xxx
- remote: Invalid username or password.
- fatal: Authentication failed for 'https://github.com/xxx/xxx/'
表示账号或密码输入错误。
4、推送「push」项目到线上
- git push origin master
完毕!
参考
http://www.tuicool.com/articles/zeaQjav
http://www.yiibai.com/git/git_pull.html
http://blog.csdn.net/bear_wr/article/details/48950339
https://stackoverflow.com/questions/2936652/git-push-wont-do-anything-everything-up-to-date