How to setup your Git, Github account on another computer

Let’s imagine that you need to use another computer to do some development work on one of your Github projects but you don’t have your computer at hand to copy your private key over. What to do then?

Generate a new SSH key

The first step is to generate a new key in your console like this:

make sure to substitute with your personal email when generating the key.

When asked where do you want to store your new key, press Enter to store it on the default location.

You will be asked to enter a passphrase(password) to protect your key. This step is optional and you can keep it blank to skip this.

Add public key to Github

After generating the key login into your Github account, go to your Account Settings by clicking the Profile Image icon on the right and selecting Settings on the displayed Menu:

In your Settings page look for SSH and GPG keys:

and click on New SSH Key:

Then go back to your terminal and print the content of your public key for the recently generated key pair:

This should output something similar to this:

copy this to your clipboard and paste it on Github adding a descriptive title:

Setup your Git

Now you have granted access to Git for our Github account on this computer is time to setup Git so commits, pull requests, etc… appear on Github with our name.

First, clone your project and pull it to the computer:

and then run these commands to configure Git for this project:

Doing this you will modify the Git configuration of the project that is stored in .git/config. After this confirm that your setup is OK by running:

and you should see this output:


With these three simple steps, you can setup your Github account and Git configuration on another computer.

I hope this tutorial was helpful and if you have any questions just let me know on the comments.

Sr. Full-stack Web and Mobile Developer