问题: github 用git bash上传项目 最后提示Everything up-to-date 但没传上去
第一次在Google Code上弄项目,注册完毕后,尝试增加一个新文件用以测试Git是否好好工作。结果在Push的时候却显示"Every up-to-date",检查文件时却发现实际上一个都没更新上去。因为对Git不够熟悉,因此只好Googling.
进行一番搜索后找到原因如下:
Why does Git refuse to push, saying “everything up to date”?
git push with no additional arguments only pushes branches that exist in the remote already. If the remote repository is empty, nothing will be pushed. In this case, explicitly specify a branch to push, e.g. git push master.
也就是说一开始git服务器仓库是完全空的,不包含任何一个分支(branch),因此刚开始Push时需要指定一个。
执行git remote -v后看到自己的remote端名字为origin:
$ git remote -v
origin [https://code.google.com/p/micolog2](https://code.google.com/p/micolog2) (fetch)
origin [https://code.google.com/p/micolog2](https://code.google.com/p/micolog2) (push)
执行git branch后看到自己当下用的分支是master:
$ git branch
master
解决方法
因此在本地commit后,再执行
git push origin master
即可。
-------------------2019-01-01---------------
其实只要查看一下你本地工作区中是否有修改的文件,可以通过一系列add, commit , push 操作进行提交。
git add .
git commit -m "xx"
git push origin master: master
PS: 若你觉得可以、还行、过得去、甚至不太差的话,可以“关注”一下,就此谢过!