Google code: Why ‘Everything up-to-date’ when pushing (git)

http://blog.csdn.net/yang3wei/article/details/8548402

 

第一次在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 (fetch) 

origin  https://code.google.com/p/micolog2 (push)

 执行git branch后看到自己当下用的分支是master:

$ git branch 

* master

 因此在本地commit后,再执行

git push origin master

 即可。

猜你喜欢

转载自hnlixf.iteye.com/blog/1911379