<?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>remote &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/remote/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>
		<item>
		<title>git 筆記: 如何將現有的 Tree 推到 remote</title>
		<link>https://richliu.com/2011/11/01/1133/git-%e7%ad%86%e8%a8%98-%e5%a6%82%e4%bd%95%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84-tree-%e6%8e%a8%e5%88%b0-remote/</link>
					<comments>https://richliu.com/2011/11/01/1133/git-%e7%ad%86%e8%a8%98-%e5%a6%82%e4%bd%95%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84-tree-%e6%8e%a8%e5%88%b0-remote/#comments</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Mon, 31 Oct 2011 17:15:36 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[remote]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=1133</guid>

					<description><![CDATA[<p>我本來在開發 AMP 的程式, 所以從 source code clone 了一個新的開發目錄, 稱 A, 再 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/11/01/1133/git-%e7%ad%86%e8%a8%98-%e5%a6%82%e4%bd%95%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84-tree-%e6%8e%a8%e5%88%b0-remote/">git 筆記: 如何將現有的 Tree 推到 remote</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>我本來在開發 AMP 的程式, 所以從 source code clone 了一個新的開發目錄, 稱 A, 再從 A clone 一個新的開發目錄, 稱 B.<br />
這時在 B 的目錄下, 沒有辦法直接 push 回 A , 因為 A 內有 source code , 所以只好再開一個新的空 git, 往上推. </p>
<p>假設主要的 tracking branch name 是 major. (一般用 origin or master, btw, 我是從別的地方再 clone 過來的, 所以不用此名)<br />
創立一個新的空 git 目錄.<br />
[BASH]<br />
$ cd /data/prj/AMP/core-data<br />
$ git init &#8211;bare<br />
[/BASH]</p>
<p>在 source code A 下, 建立一個新的 remote<br />
[BASH]<br />
$ git remote add test /data/prj/AMP/core-data<br />
$ git push test major<br />
[/BASH]</p>
<p>在 source code B 下, 加入一個新的 remote, 用 git reset &#8211;hard 是清除所有的改變, 以便 pull<br />
[BASH]<br />
$ git diff<br />
$ git reset &#8211;hard<br />
$ git remote add  test /data/prj/AMP/core-data/bare/<br />
$ git pull test major<br />
[/BASH]</p>
<p>* 若是遇到這種情形, 可以檢查是不是這個檔在是 untracked, 可以用 $ git status 查看. 如果是 untracked, 可以刪除.<br />
[BASH]<br />
$ git pull test major<br />
From /data/prj/AMP/core-data/bare<br />
 * branch            major      -> FETCH_HEAD<br />
error: Untracked working tree file &#8216;kernels/linux-2.6.35.12/arch/arm/kernel/real-amp.c&#8217; would be overwritten by merge.  Aborting<br />
[/BASH]</p>
<p>git 功能太多 :-/</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2011/11/01/1133/git-%e7%ad%86%e8%a8%98-%e5%a6%82%e4%bd%95%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84-tree-%e6%8e%a8%e5%88%b0-remote/">git 筆記: 如何將現有的 Tree 推到 remote</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2011/11/01/1133/git-%e7%ad%86%e8%a8%98-%e5%a6%82%e4%bd%95%e5%b0%87%e7%8f%be%e6%9c%89%e7%9a%84-tree-%e6%8e%a8%e5%88%b0-remote/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
