<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bare &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/bare/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Wed, 14 Nov 2012 17:56:08 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>[GIT] 將現有的目錄改成 bare 並且修改 remote server</title>
		<link>https://richliu.com/2012/11/15/1351/git-%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84%e7%9b%ae%e9%8c%84%e6%94%b9%e6%88%90-bare-%e4%b8%a6%e4%b8%94%e4%bf%ae%e6%94%b9-remote-server/</link>
					<comments>https://richliu.com/2012/11/15/1351/git-%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84%e7%9b%ae%e9%8c%84%e6%94%b9%e6%88%90-bare-%e4%b8%a6%e4%b8%94%e4%bf%ae%e6%94%b9-remote-server/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 14 Nov 2012 17:56:08 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bare]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[remote]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1351</guid>

					<description><![CDATA[<p>git 如果從另一個目錄 clone 出來, 兩邊都有 source code, 是不能直接 master p [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/11/15/1351/git-%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84%e7%9b%ae%e9%8c%84%e6%94%b9%e6%88%90-bare-%e4%b8%a6%e4%b8%94%e4%bf%ae%e6%94%b9-remote-server/">[GIT] 將現有的目錄改成 bare 並且修改 remote server</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>git 如果從另一個目錄 clone 出來, 兩邊都有 source code, 是不能直接 master push 到 master 的.<br />
會出現錯誤訊息<br />
[TEXT]<br />
git push error &#8216;[remote rejected] master -> master (branch is currently checked out)&#8217;<br />
[/TEXT]</p>
<p>這時可以產生另一個 bare 目錄, 然後到 git 目錄內下指令, 將該目錄變成 bare<br />
[BASH]<br />
# cp -a (path_to_source_dir) (path_to_bare_dir)<br />
# cd (path_to_bare_dir)<br />
# git config &#8211;bool core.bare true<br />
# rm (all source code)<br />
# mv .git/* .<br />
# rmdir .git<br />
[/BASH]</p>
<p>這樣就可以了. </p>
<p>原來的目錄可以修改 remote url 的方式指到新的目錄<br />
[BASH]<br />
# cd (path_to_source_dir)<br />
# git remote set-url origin //(path_to_bare_dir)<br />
[/BASH]</p>
<p>這時有 source code 的目錄還是用 git push/pull 更新 source code.<br />
如果是 bare 的話就是 git push, git fetch/merge 更新 source code. </p>
<p>Ref web.<br />
<a href="http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked" target="_blank" rel="noopener">http://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked</a><br />
<a href="http://stackoverflow.com/questions/2432764/how-to-change-a-remote-repository-uri-using-git" target="_blank" rel="noopener">http://stackoverflow.com/questions/2432764/how-to-change-a-remote-repository-uri-using-git</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2012/11/15/1351/git-%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84%e7%9b%ae%e9%8c%84%e6%94%b9%e6%88%90-bare-%e4%b8%a6%e4%b8%94%e4%bf%ae%e6%94%b9-remote-server/">[GIT] 將現有的目錄改成 bare 並且修改 remote server</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2012/11/15/1351/git-%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84%e7%9b%ae%e9%8c%84%e6%94%b9%e6%88%90-bare-%e4%b8%a6%e4%b8%94%e4%bf%ae%e6%94%b9-remote-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
