Home > front end >  How to return from scratch and config gitlab and github account on the same pc?
How to return from scratch and config gitlab and github account on the same pc?

Time:07-01

With my University, I have a GitLab account, but later I created my own account on GitHub for my personal use, and both are "linked" on my laptop. But in my mind, it's quite a mess : both are linked differently, and I kinda lose myself (one is with ssh key, the other one is... i'm not sure of it)

So, I want to delink entirely my two accounts, delete the ssh keys and all the things that are needed to return from scratch. What I need to do ? I don't want to make bad things. And then, how can I use both accounts on my laptop (using ssh keys) ?

I hope I was clear

CodePudding user response:

To effectively 'start from scratch' you will need to:

  1. Remove your local configurations
    a. Remove your SSH configurations/key
    b. Remove your (global) git configuration
  2. (optionally) Revoke your SSH keys from your GitHub and GitLab accounts online

Removing your local configurations

Your SSH configuration is, by default, stored in the .ssh directory in your user profile. This is probably also where your key(s) are stored. To effectively 'start over' you can move (recommended in case you want to restore it) or delete this directory entirely.

Same goes for your git configuration, except this is .gitconfig rather than .ssh

On Windows in command prompt/powershell you can move the directory like so (assuming your in your user home directory):

move .\.ssh .\.ssh.old
move .\.gitconfig .\.gitconfig.old

On MacOS or Linux systems, you can do the following:

mv ~/.ssh ~/.ssh.old
mv ~/.gitconfig ./.gitconfig.old

Removing your SSH keys from GitLab/GitHub

GitLab

For GitLab, navigate to https://gitlab.com/-/profile/keys (replace the URL if you're using a self-hosted gitlab server) -- here you can see a list of your public SSH keys you have added to GitLab and remove them by clicking the trashcan icon.

GitHub

For GitHub, navigate to https://github.com/settings/keys -- you will see a list of keys you have added and you can remove them by clicking the "delete" button.

Between all these actions, you will effectively have "started from scratch" with respect to your computer's git configurations.

  • Related