all repos — www @ bd9f9a7d8331731ab93cf143a826654a21bf1ec1

deserthorns.net content + generator

wiki/pages/git.html (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
{{ define "styles" }}
{{ end }}

{{ define "content" }}
<h1>git</h1>
<p>
    <a href="https://git.deserthorns.net/">My git repositories</a> are hosted on a VPS and use <a href="https://github.com/icyphox/legit">legit</a> for the web frontend.
</p>
<p>
    Pushing using HTTP/S is disabled, pushing must be done over SSH.
</p>
<h2>Creating a new repo</h2>
<p>
    First, a new bare repo needs to be created <strong>on the server</strong>.  In my case, all git repos are stored on the server in <code>/var/git</code>:
</p>
<pre>
cd /var/git
mkdir my-new-repo
cd my-new-repo
git init --bare
</pre>
<p>
    Once the bare repo on the server has been created, switch to a client and create a new working (non-bare) repo:
</p>
<pre>
mkdir my-new-repo
cd my-new-repo
git init
</pre>
<p>
    With this, the working repo has been created on the client, now we can add content and commit it:
</p>
<pre>
** Add/change some stuff, make a readme... **
git add .
git commit -m "initial commit"
</pre>
<p>
    Now we need to do the inital push and update the remote for the repo to be the server repo (you need to have already <a href="/wiki/ssh">set up SSH</a> for the remote user that you are using to do the push):
</p>
<pre>
git remote add origin &ltREMOTE_USER&gt@git.deserthorns.net:/var/git/my-new-repo
git push --set-upstream origin master
</pre>
<p>
    Now our repo on the server should have the files added/changed by the client.
</p>
<p>
    After the initial commit, pushing is easy as:
</p>
<pre>
** Add/change some stuff **
git add .
git commit -m "did stuff"
git push
</pre>

<h2>Cloning over SSH</h2>
<p>You need to have already <a href="/wiki/ssh">set up SSH</a> for the remote user that you are using to clone!</p>
<pre>git clone &ltREMOTE_USER&gt@git.deserthorns.net:/var/git/my-repo</pre>
{{ end }}

{{ define "scripts" }}
{{ end }}