all repos — www @ e8fd06b449accb5886da0e3e4aca7211ceb45109

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
{{ 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 set up SSH for the user that you are using to do the push):
</p>
<pre>
git remote add origin &ltSSH_USERNAME&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>
{{ end }}

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