neuropoly / data-management

Repo that deals with datalad aspects for internal use
4 stars 0 forks source link

Cannot commit, issue with gpg #196

Closed jcohenadad closed 1 year ago

jcohenadad commented 1 year ago

This might be more appropriate to post in the ‘computers’ repository, but on rosenberg, i’m trying to commit some code but i am getting this:

(base) p101317@rosenberg:~/code/ivadomed$ git commit
error: gpg n'a pas pu signer les données
fatal: échec de l'écriture de l'objet commit

Note that it used to work in the past (a few months ago), so i’m not sure what changed. Maybe GH’s authentication method that only relies on token for clone with https.

sidenote: searching on the internet for french error messages is less effective-- it would really help me (and non-francophone students in the lab) to at least move the default language of computers to english.

mguaypaq commented 1 year ago

The command git commit only runs locally on whatever computer you're connected to via ssh, and doesn't contact GitHub, so this is unrelated. It looks like maybe this is related to using GPG to cryptographically sign your commit, is this the normal workflow for ivadomed?

Normally git doesn't sign commits by default, but you can check the output of git config -l | grep gpg to see if yours is configured to do it for some reason.

Also, you can get english error messages if you set the environment variable LANG=en_CA.UTF-8 in your shell. I've done this myself by writing it in the file ~/.pam_environment on joplin, rosenberg, etc.

jcohenadad commented 1 year ago

Also, you can get english error messages if you set the environment variable LANG=en_CA.UTF-8 in your shell. I've done this myself by writing it in the file ~/.pam_environment on joplin, rosenberg, etc.

Awesome! Thank you for the tip

jcohenadad commented 1 year ago

Normally git doesn't sign commits by default, but you can check the output of git config -l | grep gpg to see if yours is configured to do it for some reason.

Hum, it doesn't seem so:

$ git config -l | grep gpg
commit.gpgsign=false
jcohenadad commented 1 year ago

Ah! I know, I'm using an alias gc='git commit -S -a' because I use gpg signing on my laptop, and I blindly copy-pasted my bashprofile onto rosenberg, so that's the issue. Removing the "-S" solves it.

However now I am running into another authentication issue for pushing:

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/ivadomed/model_seg_ms_mp2rage.git/'

So that is something I need to dig in more...

mguaypaq commented 1 year ago

Ah! That's because it's configured as an HTTPS remote. Here's the section of the GitHub docs about authentication over HTTPS, your case is the paragraph which starts with:

If you authenticate without GitHub CLI, you must authenticate with a personal access token.

Alternatively, you can also use GitHub as an SSH remote by:

  1. using git remote add ... (I'd have to look up the exact command);
  2. creating an SSH private/public key pair on rosenberg (if you don't already have one on that server);
  3. adding the public part of that key to your account on GitHub (under "Settings" -> "SSH and GPG keys")

(This is similar to how we need a separate SSH private/public key configured on data.neuro.polymtl.ca for each computer.)

jcohenadad commented 1 year ago

Ah! That's because it's configured as an HTTPS remote. Here's the section of the GitHub docs about authentication over HTTPS, your case is the paragraph which starts with:

Yes I know, I created a personal token a few months ago and have used it without problem so far. I've already spent one hour yesterday figuring out why it doesn't work on rosenberg, but without success. I will try the SSH clone as you suggested, thank you.

jcohenadad commented 1 year ago

OK, the SSH clone solution worked like a charm in less than 2min. I'll just never use HTTPS again 😅 . Thank you for the help @mguaypaq