手机版
你好,游客 登录 注册
背景:
阅读新闻

Git 使用及实战教程

[日期:2013-03-15] 来源:Linux社区  作者:longerzone [字体:大 中 小]

OK,我们会发现push 出错了!这是由于git默认拒绝了push操作,此时我们需要做的是在服务器端进行设置,在 .git/config ( $ vim .git/config )末尾追加如下代码:

[receive]

denyCurrentBranch = ignore

此时我们再回到客户端,重新push,发现一切正常

long@long-Ubuntu:~/study$ git push
Password:
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To zyl@project:/home/zyl/study.git/.git
  9315d31..53affb3  master -> master
long@long-Ubuntu:~/study$ git log
commit 53affb3a2c53765b279c0f7b29422c88a6b9f8fa
Author: zyl <reaper888@yeah.net>
Date:  Wed Mar 13 14:05:45 2013 +0800

    first test of client

commit 9315d31ed352ada76f1c37fa57b3dd0c7ed00545
Author: zyl <zyl@project.lzu.edu.cn>
Date:  Wed Mar 13 10:57:23 2013 +0800

    my first push
long@long-Ubuntu:~/study$

3.3 追加一个问题:

如果使用了git init 初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时,如果远程仓库正在push的分支上(如果当时不在push的分支,就没有问题),那么push后的结果不会反应在work tree上,也即在远程仓库的目录下对应的文件还是之前的内容,必须得使用git reset --hard才能看到push后的内容。

linux
相关资讯       Git教程  Git使用  Git使用教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款