Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot git clone a folder on a server and then edit and git push?
    text
    copied!<p>I used Mercurial (Hg) before, and it was ok to do something like at the local PC:</p> <pre><code>hg clone ssh://peter@hostingcompany.com/~/mysite.com </code></pre> <p>and then will have a local folder called <code>mysite.com</code>, and I can edit its content, commit, and say <code>hg push</code> and push it to the server. Of course, to have the content show up in the "working directory", I will have to <code>ssh</code> there and do an <code>hg up</code>.</p> <p>With Git, if I do the same, at the server, do a</p> <pre><code>git init git add . git commit -m "ok" </code></pre> <p>and at the local PC, do a</p> <pre><code>git clone ssh://peter@hostingcompany.com/~/mysite.com </code></pre> <p>but when I edit a file and <code>git push ssh://peter@foo.com/~/mysite.com master</code>, then it will refuse it, because it is not a "bare repository".</p> <p>Is there a way to</p> <ol> <li>Push it anyway, like Hg?</li> <li>Or, better yet, push it and have it automatically do something like <code>hg up</code> -- is it <code>git checkout</code>, so that the content is immediately visual on mysite.com (using any web browser anywhere).</li> </ol> <hr> <p><strong>Update:</strong></p> <p>It seems that the usual practice is to push to a bare repo... but can we not use a bare repo and make (2) above work? If it is a practical way, then we don't have to stick to the "push to bare repo" rule?</p> <p>If there are other reason still to push to a bare repo and clone on the server... then:</p> <p>if the server had directories such as <code>~/mysite.com</code> and <code>~/other_folder</code> etc, then where should the repo for <code>mysite.com</code> sit? <code>mysite.com</code> is the content of the website, so if I put an <code>index.html</code>, then any browser in the world can see it. So is it good to create a bare repo, let <code>~/mysite.com</code> clone from it, and on the local PC, use <code>git push &lt;path&gt; master; ssh &lt;path&gt; "cd to that folder and do git checkout to update the content"</code> automatically by 1 line on the local PC? Will the line be <code>git push ssh://peter@hostingcompany.com/~/mysite.com master; ssh ssh://peter@hostingcompany.com/~/mysite.com 'git pull; git checkout'</code> ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload