Github commands and SSH keys (safiest)

-SSH Key How to make one, connect it to GitHub, and How to use it

So basically an SSH key helps us to have better security when we interchange messages, for example, a code
that we want to share that resides in our laptop but without putting in danger our own system.
So these keys count with a complex algorithm impossible to hack, about two key one public (the one we
can share to others without problem) this will codify the message and will send it to the private key
(the one we have in our system and has never be shared), this last key will decrypt the message.
Now how to create this key in windows, it’s simple. Go to your GitBash App and write the following command
" ssh-keygen -t RSA -b 4096 -C “[email protected]” " (generate ssh key type RSA (famous and most used
algorithm) use 4096 bits(number of bits dedicate to make the key, this is the max) and finally related the
key to the next e-mail).

Once you generate your key, it may ask you to make a password (something like a password), for more security is advisable to put one. after that accept writing yes (It will tell you where to put the new key, it is not
needed to indicate the folder).

So now you have your keys, to see them you can go to the home page with “cd ~/” then to see the hidden folder you may command “ls -la” or just “cd /.ssh/” once inside you will see the private and public “ssh_rsa.pub”.
The next step is to connect this public key to your GitHub account. First, you need to open the field of the pu-
public key “ssh-rsa.pub” with the command “cat key_rsa.pub” or “code key_rsa.pub” (visual studio code).

Copy all the algorithm and go to your GitHub account to settings and SSH KEYS section, and click on create key. Put a description(like this key from where does it comes) and paste the algorithm in the section below.
Vala you have already your ssh key and you connect it to your Github account so now you can download fields from the GitHub platform secured and faster without extra passwords every time you want to download a repository.

Go to the folder you want to have your project and once there write the next command "git remote -v (here
you paste the link you copy from GitHub when you click on the button clone by ssh)"
then you are ready to go, you can see the folders inside and see the new folder you downloaded.
Now to commit changes and save them in the original field. First pull the repository all the time you want
to commit or push the results (It’s best practice).

Just go to your Gitbash App and write alias (the alias you want)="the command you want to call with the alias"
and I will be done, now once you write your alias it will execute automatically the command you wrote in double-commas

To make a tag you will need the id of the version you want to be tagged. After that write the next command “git tag -a
v0.1(or the version you want) -m “the message you want” [copy and paste the id of the version you want to be tagged].
Preferably it’s useful to use tags in Github so you may do a “git pull origin master” best practice and add the tag to GitHub
writing “git push origin --tags”.
To delete a tag you may delete it from the GitBash App and GitHub also, so firstly on the GitBash app you want to write
"git tag -d v1.0(the name you gave to the tag)”, the best practice “git pull origin master” and finally “git push origin --tags”.
But it still in Github because it used it as releases, so in the GitBash app we must write “git push origin: refs/tags/v1.0” to delete the tag in the GitHub App.

If you want to see the tags in the project write “git tag"
to see the version related to the tag write"git show-ref --tags”

Basic commands: to change branch “git checkout nameOfBranch” and to show the branches in the project "git branch"
There are important commands as “git show-branch --all”, that show the history of branches of the project. Another important command it’s "gitk"
that will show a perfect graph of the project and branches.

To add a branch firstly as best practice we must “git pull origin master” to bring the updated version and then “git checkout nameOfBranch” and finally
"git push origin named branch".
To create a new branch simple as “git branch NameOfBranch” and “git checkout nameOfBranch” to change to other branches.

Escribe tu comentario
+ 2