Posts

Showing posts from 2020

How to Fix GIT PUSH ERROR: insufficient permission for adding an object to repository database .git/objects

Image
I use git for all my projects and I have an on-premise git server in my company. This git is hosted on a Linux server. All developpers have a user account on this Linux machine attached to the developers group. My Jenkins server for CI/CD also has its own account on this Linux.

My problem occurs when I make a Maven Release which tags source code on git, upadte project version on my pom.xml file and push it on git. I often have write permission issue.

Let's do a small disgnostic. I open an ssh terminal on my git Linux with Jenkins account. I nagivate to a repository (a /opt/git/ subfolder - depending on your installation). Let's create a dummy file and check its ACL.

cd /opt/git/my-project.git
touch test
ls -lisa test
-rw-r--r-- 1 jenkins developers 34618 june. 23  2020 test

We can see that only the owner can modify this file. Other uiers from the developers group could only read it. That's the problerm : we have to set default ACL on this folder.

Okay, let's do this. We w…

List git activity history on all your projects

For Linux users, you can, with only one command line, get all your development activities for the last week. Use full to do your weekly report.

Let's do :

find . -type d -name '.git' -exec echo {} \; -exec git -C {} log --author=[username] --since="1 weeks ago" \;


Enjoy!

Set Ubuntu user password in Windows 10

As I tried to make sudo command from my Ubuntu 18.04 running inside Windows 10 (Yes you can get Ubuntu running inside Windows 10 from the Microsoft Store! Awesome!), I realized I didn't set any password to my current user, which is needed to run a sudo command.

So, to do that, you first have to know you current Ubuntu username (asked when you install Ubuntu from the Microsoft store). Suppose your user is alex. We will do :


Switch current Ubuntu user to root. To do that, open a Windows 10 Command or Powershell console and run :  ubuntu1804 config --default-user rootOpen your Ubuntu App (from the Windows 10 start menu). This will open Ubuntu bash in root instead of your userRun 'passwd alex' to set alex password and close your Ubuntu shellSwitch Ubuntu back to alex as default user by running the following command from your current Windows 10 Command or Powershell console :  ubuntu1804 config --default-user alex That's all. When you will start again Ubuntn App, you will be…

Put your Tomcat behind a reverse proxy on CentOS

Image
I have an API service with an embedded tomcat running on port 8080 on a CentOS server. I don't want to expose it directory and I want to access this API threw HTTPS (port 443). If I access to it on 'classic' http (port 80)

A simple solution is to deploy an Apache httpd server on my CentOS and use is as reverse proxy.




Step 1 : install Apache httpd server
yum install httpd
yum install mod_ssl

Open /etc/https/conf/httpd.conf file and add the directive Listen 443 after Listen 80 to enable apache to listen to port 443

Step 2 : Install your certificate files
First all all, you can to install your certificate by copying  your three files to a directory of your choice. For me, it's /etc/ssl like this :


000000000 4 -rw-r--r--.   1 root root 1674  9 janv. 18:20 intermediate-CA.key
000000000 4 -rw-r--r--.   1 root root 1708  9 janv. 18:20 private.key
000000000 4 -rw-r--r--.   1 root root 2248  9 janv. 18:20 public.key

Everything is x509 key encoded in base64
private.key is the key yo…