Commit 4770de43313fa54174cd72414268cd07321ced50

Thomas de Grivel 2022-01-21T08:18:18

add git help

diff --git a/lib/kmxgit_web/controllers/page_controller.ex b/lib/kmxgit_web/controllers/page_controller.ex
index fd18f3d..3302ef5 100644
--- a/lib/kmxgit_web/controllers/page_controller.ex
+++ b/lib/kmxgit_web/controllers/page_controller.ex
@@ -40,6 +40,7 @@ defmodule KmxgitWeb.PageController do
     else
       conn
       |> assign(:disk_usage, du_ks("/home/git"))
+      |> assign(:git_ssh_url, Application.get_env(:kmxgit, :git_ssh_url))
       |> assign(:org_count, OrganisationManager.count_organisations())
       |> assign(:repo_count, RepositoryManager.count_repositories())
       |> assign(:user_count, UserManager.count_users())
diff --git a/lib/kmxgit_web/templates/page/index.html.heex b/lib/kmxgit_web/templates/page/index.html.heex
index deca88d..07066b6 100644
--- a/lib/kmxgit_web/templates/page/index.html.heex
+++ b/lib/kmxgit_web/templates/page/index.html.heex
@@ -18,6 +18,38 @@
       <h3><%= gettext "SSH keys fingerprint" %></h3>
       <pre><%= render("ssh_keys_fingerprint.txt") %></pre>
 
+      <h3><%= gettext("Help") %></h3>
+      <div class="highlight">
+        <pre><code><span class="c1"># <%= gettext "Clone repository user/path/to/repo if repo does not exist" %> :</span>
+git clone <b><%= @git_ssh_url %>:user/path/to/repo.git</b>
+cd <b>repo</b>
+
+<span class="c1"># <%= gettext "Change branch" %> :</span>
+git branch <b>master</b>
+
+<span class="c1"># <%= gettext "Pull changes from remote" %> :</span>
+git pull
+
+<span class="c1"># <%= gettext "Add local changes to next commit" %> :</span>
+git add <b>README.md static/index.html</b>
+
+<span class="c1"># <%= gettext "Commit" %> :</span>
+git commit -m "<b>a short and descriptive message</b>"
+
+<span class="c1"># <%= gettext "Push changes to remote" %> :</span>
+git push
+
+<span class="c1"># <%= gettext "Or if your local repo already exists," %></span>
+<span class="c1"># <%= gettext "Add remote to existing repo" %> :</span>
+git remote add kmx <b><%= @git_ssh_url %>:user/path/to/repo.git</b>
+
+<span class="c1"># <%= gettext "Push to new remote" %> :</span>
+git push -u kmx master</code></pre>
+      </div>
+      <p>
+        Get the git url at <b><%= Routes.page_url(@conn, :index) %>user/path/to/repo</b>
+      </p>
+
       <h3><%= gettext("Stats") %></h3>
 
       <div class="row">