To configure a GitHub account in Git, you must first have a GitHub account. If you do not have one yet, you can create one on their website by clicking here. Once you have an account, you must generate an SSH key on your computer.
How to create and copy an SSH key
This will allow you to connect to your GitHub account securely without having to enter your password every time. To generate an SSH key, run the following command:
# ssh-keygen -t rsa -b 4096 -C "tu_correo@ejemplo.com" -f ~/.ssh/llaveReplace "tu_correo@ejemplo.com" with your GitHub account email address. This command will generate a pair of keys, one public and one private.
Press "Enter" to accept the location where the key will be saved and enter a password to protect the private key (make sure to choose a secure password that is easy to remember). Once you have generated the SSH key, you must add it to your GitHub account. To do this, run the following command to display and copy the public key to your clipboard:
# cat ~/.ssh/llave.pubHow to add a public key to GitHub
Then sign in to your GitHub account, click your profile picture in the upper-right corner, and select "Settings" (Settings). Next, click "SSH and GPG keys" (SSH and GPG keys) in the menu on the left, then click the "New SSH key" (New SSH key) button in the upper right. In the "Title" (Title) field, enter a descriptive name for the key, such as "My computer". Click the "Key" (Key) field and paste the public key you copied earlier from your clipboard. Click the "Add SSH key" (Add SSH key) button to save the key.
How to configure the account in Git
Now that you have added the SSH key to your GitHub account, you can configure Git on your computer to use it. To do this, open a terminal window on your computer and run the following command to configure your Git user with your GitHub name and email address:
# git config --global user.name "nombre_de_usuario"# git config --global user.email "tu_correo@ejemplo.com"Replace "nombre_de_usuario" and "tu_correo@ejemplo.com" with your GitHub name and email address, respectively. Run the following command to enable SSH key authentication in Git:
# git config --global credential.helper sshWith this, you should now be able to use your GitHub account with Git.
How to verify that Git works
To test it, you can clone a private repository from your GitHub account to your local computer by running the following command:
# git clone git@github.com:nombre_de_usuario/nombre_de_repositorio.gitReplace "nombre_de_usuario" and "nombre_de_repositorio" with your GitHub username and the name of the repository you want to clone, respectively. If everything is configured correctly, Git should ask you for your SSH key password to authenticate with your GitHub account and clone the repository.
Remember, if you have questions about this or any other issue related to your servers on Clouding, do not hesitate to write to soporte@clouding.io We are here for whatever you need. Contact us!