<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[阿Tim日志]]></title> 
<link>https://atim.cn/index.php</link> 
<description><![CDATA[专业的php开发者.开发团队的带队人]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[阿Tim日志]]></copyright>
<item>
<link>https://atim.cn/post//</link>
<title><![CDATA[git push 出错]]></title> 
<author>bkkkd &lt;partybase@gmail.com&gt;</author>
<category><![CDATA[开发应用]]></category>
<pubDate>Sat, 12 Nov 2011 02:41:09 +0000</pubDate> 
<guid>https://atim.cn/post//</guid> 
<description>
<![CDATA[ 
	在使用Git Push代码到数据仓库时，提示如下错误:<br/><div class="code"><br/>&#91;remote rejected&#93; master -&gt; master (branch is currently checked out)<br/>remote: error: refusing to update checked out branch: refs/heads/master<br/>remote: error: By default, updating the current branch in a non-bare repository<br/>remote: error: is denied, because it will make the index and work tree inconsistent<br/>remote: error: with what you pushed, and will require &#039;git reset --hard&#039; to match<br/>remote: error: the work tree to HEAD.<br/>remote: error:<br/>remote: error: You can set &#039;receive.denyCurrentBranch&#039; configuration variable to<br/>remote: error: &#039;ignore&#039; or &#039;warn&#039; in the remote repository to allow pushing into<br/>remote: error: its current branch; however, this is not recommended unless you<br/>remote: error: arranged to update its work tree to match what you pushed in some<br/>remote: error: other way.<br/>remote: error:<br/>remote: error: To squelch this message and still keep the default behaviour, set<br/>remote: error: &#039;receive.denyCurrentBranch&#039; configuration variable to &#039;refuse&#039;.<br/>To git@192.168.1.X:/var/git.server/.../web<br/> ! &#91;remote rejected&#93; master -&gt; master (branch is currently checked out)<br/>error: failed to push some refs to &#039;git@192.168.1.X:/var/git.server/.../web&#039;<br/></div><br/>这是由于git默认拒绝了push操作，需要进行设置，修改.git/config添加如下代码：<br/><div class="code"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&#91;receive&#93;<br/>&nbsp;&nbsp;&nbsp;&nbsp;denyCurrentBranch = ignore<br/> </div><br/>在初始化远程仓库时最好使用 git --bare init&nbsp;&nbsp; 而不要使用：git init<br/>&nbsp;&nbsp; 如果使用了git init初始化，则远程仓库的目录下，也包含work tree，当本地仓库向远程仓库push时,&nbsp;&nbsp; 如果远程仓库正在push的分支上（如果当时不在push的分支，就没有问题）, 那么push后的结果不会反应在work tree上,&nbsp;&nbsp;也即在远程仓库的目录下对应的文件还是之前的内容，必须得使用git reset --hard才能看到push后的内容.
]]>
</description>
</item><item>
<link>https://atim.cn/post//#blogcomment</link>
<title><![CDATA[[评论] git push 出错]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://atim.cn/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>