SSH key for GitLab in Windows OS

Did you wonder why are are getting Could not read from remote repository error conecting from your PC, this usually happend when we start working on a new pc or just a fresh configuration … you try to clone you nice code from your repo and POW !

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Start by having a nice git client installed, I recomment https://git-scm.com/downloads/win since it add the “Open Git Bash Here” option to the right click on Windows. Warning Windows 11 have that option hidden under “Show more options”

If you are like my and prefer the Classic Menu Content follow this steps otherwise skip this steps

  1. Open a Command Prompt Window
  2. Type the next command and click Enter
    reg.exe add “HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32” /f /ve
  3. Restart File Explorer, you have two options: a) From Task Manager find Windows Explorer, right click it and select restart. b) Or restart your PC
  4. If you are not happy with the change you can reset it back to the new Moderm Context Menu
    Type the next command at a Command Prompt Window and click Enter
    reg.exe del “HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\” /f

* reference answers.microsoft.com restore-old-right-click-context-menu-in-windows-11

Back to bussines, add SSH to fix the error and get remote access

  1. Open Git Bash window
  2. Generate the key, paste the text below, replacing the email used in the example with your GitHub email address.
    sh-keygen -t rsa -b 4096 -C "your_email@example.com"
  3. Copy the key on you clipboard
    clip < ~/.ssh/id_ed25519.pub
  4. Login to your GitHub account,
  5. Click you avatar, select SSH and GPG keys,
  6. Click New SSH key and paste it 🙂

*reference and detailed steps:

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

Git gitignore pain :) sample scenario gradle.properties

This is the scenario:

New project, new IDE, you clone the project, Gradle fails, and you find out you are required to enter your credential in clear text into the gradle. properties… Keep reading 😉

What is required?

maven_user=YourUser

maven_pass=YourPasswordHere_BeCarfullDoNotCommitThisFileWithYourPass

BUT !

If the .gitignore file for the project does not have a line to exclude gradle.properties, the file will be listed as modified (which is correct), but you do not want to commit that change and make your credentials public.

Even if you go ahead and add the exclusion to the .gitignore the file will be included, but there is a fix.

.gitIgnore adding the exclusion

##Additional ignore

##Gradle properties due sensitive information to login

gradle.properties

git status

If you try a git status, you will notice gradle.properties is reported as modified even if you added it to the .gitignore file.

How to solve it

git rm -r –cached gradle.properties

Now gradle.properties changes have been removed from the cache, and you will be able to change them at any time without them being reported as modified since it is already on you . gitignoref file.

Additional Tip

II recommend adding a lot of blank lines so your credentials will not be visible if you open your gradle.properties in a call or when someone is looking at your screen, add some kind of warning, like:

##### WARNING YOUR PASSWORD IS ABOUT TO BE SEEN ####

##### WARNING YOUR PASSWORD IS ABOUT TO BE SEEN ####

That way, you will remember having that valuable information on the file any time you open it.

Final Note

Having maven_user and maven_pass on the project level is not the best option. Find your .gradle home directory, add gradle.properties there (if not already there), and add your desired configuration there, so you can forget about it once you have done it.

I hope you find this post useful.

How do I reset all my xfce desktop settings

XFCE stores it’s configuration for the running session in xfconfd. Feel free to back up the files you’re going to delete first.

  1. Shut down the panel first, xfce4-panel --quit
  2. Kill the xfce4 configuration daemon, pkill xfconfd
  3. First delete settings for the panel, rm -rf ~/.config/xfce4/panel
  4. Clear out the settings for xfconfd, rm -rf ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
  5. Restart the panel, run xfce4-panel. This will respawn xfconfd automatically. Note if you need or want to restart xfconfd manually know that on my installation it was in /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd which was outside of $PATH.

This clears it for the running session, regenerates the files, and sets up the default for future sessions.

One line version:

xfce4-panel --quit ; pkill xfconfd ; rm -rf ~/.config/xfce4/panel ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml ; xfce4-panel;

Info original of Evan Carroll