Remote: error: insufficient permission for adding an object to repository database objects

If you push code to a git repo, you might get this error :

remote: error: insufficient permission for adding an object to repository database objects
remote: fatal: failed to write object

Make sure that the system permissions are set properly. Stackoverflow provides some good troubleshooting steps.

The commands below solve the issue :

cd /path/to/repo.git
chgrp -R groupname .
chmod -R g+rwX .

git config core.sharedRepository true
 

For groupname, make sure it matches the user account details that you use for logging in and pushing code to the git server.

 

/usr/bin/ssh-copy-id: ERROR: No identities found

/usr/bin/ssh-copy-id: ERROR: No identities found

The error occurs when you want to copy your public key to a remote server using the utility ssh-copy-id

By default, the program looks for ~/.ssh/id_rsa.pub

If you have generated dsa keys, the location of your public file must be specified explicitely :

ssh-copy-id -i ~/.ssh/id_rsa.pub

Create an alias in your bashrc file such as :

alias cpid=’ssh-copy-id -i ~/.ssh/id_rsa.pub’

Reload your bashrc file to have this new alias available in your shell.

 

Using the netrc file for curl

Using a netrc file in curl is useful to avoid typing your password for each new request.

The syntax of your netrc file is as follows :

machine fqdn_of_your_server
login your_login
password your_password

If you log in using any LDAP-based authentication, make sure to add the DOMAIN.


machine fqdn_of_your_server
login your_login@DOMAIN
password your_password

Make sure to change the permissions on your netrc file :

chmod 600 netrc

By default, curl looks for a netrc file in your home directory.
If needed, you can manually mention the location of your netrc file :

curl --netrc-file mynetrc

POSIX date format in Perl

To make a Perl script portable is to avoid using system commands as much as possible. To deal with date formats actions, you’d better use DateTime or Date::Calc modules.

For a simple formatting of the current date using localtime() Perl function :

#!/usr/bin/perl
use POSIX qw(strftime);
my $date = strftime “%d-%m-%y”, localtime;

Instead of :

my $date = qx(date +%d-%m-%y);

Both work. The first one is more Perlish 😉

More info :
POSIX Function strftime() in Perl
DateTime Perl module
Date::Calc Perl module