From: Danilo M. Date: Sat, 18 Apr 2026 17:38:38 +0000 (+0200) Subject: fixed syntax in article git-setup-own-server X-Git-Tag: release_22042026-1342~90 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=5a54cb9434af78893d8571ecafff5309d4968554;p=danix.xyz-2.git fixed syntax in article git-setup-own-server --- diff --git a/content/en/articles/git-setup-own-server/index.md b/content/en/articles/git-setup-own-server/index.md index 5fa9186..0861dc6 100644 --- a/content/en/articles/git-setup-own-server/index.md +++ b/content/en/articles/git-setup-own-server/index.md @@ -83,7 +83,6 @@ Now that the access for the git user is setup we have one last thing to do befor ```bash cp -R /usr/doc/git-2.14.4/contrib/git-shell-commands /var/git chown -R git:git /var/git - ``` Now we have 2 commands inside the git-shell-commands directory, list and help, the first will show all projects inside the /var/git directory and the other will show a simple help text and a list of all the commands available. Now to give you an example of how easy it is to add commands to the git-shell I will create a simple command that acts as the clear command, it will clean the screen, to do so, from inside the /var/git directory I did: @@ -91,7 +90,6 @@ Now we have 2 commands inside the git-shell-commands directory, list and help, t ```bash echo $(which clear) > git-shell-commands/clear chmod 0755 git-shell-commands/clear - ``` and now I have a "clear" command available for my git user. Another useful command will be "create" to add a repository and a "destroy" to remove it. Let's see them in the next page. @@ -102,7 +100,7 @@ Let's focus on the two most important scripts for our git server, the **create** ### create -{{< highlight bash "linenos=table" >}} +```bash #! /bin/bash # usage: create - create a git bare repository named PROJECT.git @@ -235,7 +233,7 @@ else esac fi fi -{{< /highlight >}} +``` This is the create script, as you can see it's a bit complex because it will do a few things for me: @@ -248,19 +246,20 @@ This is the create script, as you can see it's a bit complex because it will do So after saving this script as create inside the git-shell-commands directory, we'll give it executable permissions and we can move to the delete script. -{{< highlight bash >}} +```bash cat create-bare-repo.sh > /var/git/git-shell-commands/create chown git:git -R /var/git/git-shell-commands chmod 0755 /var/git/git-shell-commands/create -{{< /highlight >}} +``` ### delete Let's see the delete script: -{{< highlight bash "linenos=table" >}} +```bash #! /bin/bash + # usage: delete - PERMANENTLY delete a repository if existing. # CAREFUL, this action cannot be undone. This command will ask for confirmation. @@ -310,7 +309,7 @@ if [ -d ${GITDIR}/${PROJECT}.git ]; then exit 177 fi fi -{{< /highlight >}} +``` This script is much simpler than the previous one, it'll accept the name of the project as argument on the command line or will ask for it and will only delete it if it is a proper git repository, otherwise it will just exit with an error code. @@ -318,7 +317,7 @@ I improved the way those scripts recognise a git repository from simply relying Since we are here let's modify the help command to make it show a short description of every available command. -{{< highlight bash "linenos=table" >}} +```bash #!/bin/sh # usage: help - Lists all the available commands @@ -350,11 +349,11 @@ else esac done fi -{{< /highlight >}} +``` The main thing I added is the support for a command line argument, now I'm able to run it by itself and display the usual output with a list of available commands, or followed by a command name to give a brief explanation like this: -{{< highlight bash >}} +```bash git> help Hi git, Run 'help' for help, 'help ' for specific help on a command, run 'exit' to exit. Available commands: clear @@ -365,7 +364,7 @@ git> help create usage: create - create a git bare repository named PROJECT.git this command will setup the repo and send a mail for confirmation. git> -{{< /highlight >}} +``` Pretty nice isn't it?! Now it's much more user friendly, and to show the description I used awk and cut to parse the comment at the top of every script I have in the `git-shell-commands` directory. @@ -377,18 +376,20 @@ In the next page we'll see the usual routine I follow when working with this new Let's say I had a new idea for a WordPress plugin, I can't wait to start writing, so the setup of the GIT environment should be as fast as possible. That's where my setup will come in handy. Let's open the terminal, I'll go inside my testing directory and from there I'll run: -{{< highlight bash >}}ssh git_ssh 'create awesomePlugin' +```bash +ssh git_ssh 'create awesomePlugin' creating project "awesomePlugin.git" Initialized empty Git repository in /var/git/awesomePlugin.git/ All done, you can now work on "awesomePlugin.git" -{{< /highlight >}} +``` The project is created, now I just need to clone it -{{< highlight bash >}}git clone ssh://git_ssh:/var/git/awesomePLugin.git +```bash +git clone ssh://git_ssh:/var/git/awesomePLugin.git Cloning into 'awesomePlugin'... warning: Looks like you cloned an empty repository. -{{< /highlight >}} +``` And that's it, I now have a local and a remote copy of my git repository ready to work with. @@ -396,17 +397,19 @@ Let's say I'm working on this plugin and I get to the point where I feel like I Inside the deploy.sh script I'll edit those 2 lines: -{{< highlight bash >}}# Directory where to deploy files from repository +```bash +# Directory where to deploy files from repository DPTARGET="" # Branch that is going to be deployed to server DPBRANCH="master" -{{< /highlight >}} +``` adding `/var/www/wp-content/plugins/awesomePlugin` as `DPTARGET` and production as `DPBRANCH`. now on my local system I'll add a new branch and use that before committing my stable code. -{{< highlight bash >}}git checkout -b production +```bash +git checkout -b production Switched to a new branch 'production' git add . @@ -429,7 +432,7 @@ remote: | Tag name : release_12072018-1110 remote: \============================== To ssh://git_ssh:/var/git/awesomePlugin.git * [new branch] production -> production -{{< /highlight >}} +``` And that's it, now my new plugin is ready to go live as soon as I activate it inside my WordPress admin area. diff --git a/themes/danix-xyz-hacker/assets/css/main.min.css b/themes/danix-xyz-hacker/assets/css/main.min.css index 9ce65bf..899978a 100644 --- a/themes/danix-xyz-hacker/assets/css/main.min.css +++ b/themes/danix-xyz-hacker/assets/css/main.min.css @@ -1855,10 +1855,6 @@ article.border.border-border\/30.rounded-lg.card.group.bg-bg { display: inline-flex; } -.table { - display: table; -} - .grid { display: grid; }