Git (Config)

Here, you will find how to config projects with git :

First of all you have to set your default ssh key, go to the ssh directory :

$ sudo -s
$ cd ~/.ssh
$ chown -R yourusername: ~/.ssh          (be sure that your user own the rights)
$ vi known_hosts                         (create this file if it's not exists)
$ sh-keygen -t rsa -b 4096 -C "your_email@example.com"
$ ssh-keygen -lf ~/.ssh/id_rsa.pub       (show the fingerprint)
$ eval "$(ssh-agent -s)"                 (ensure ssh-agent is running)
$ ssh-add -l                             (list the ssh-key in ssh-agent)
$ ssh-add ~/.ssh/id_rsa                  (add your ssh-key in ssh-agent)
$ ssh -vT git@github.com                 (test the connection on github)
$ pbcopy <~/.ssh/yourproject_id_rsa.pub  (copy the ssh-key in clipboard)
Add the keygen in the ssh-keygen tab in your github account.
———————————–  A way to config multiple ssh-key with different projects ————————————–
First of all, be careful about the rights and you must realize this as a normal user and not root.
The ~/.ssh directory must be own by you if not : chown -R yourusername ~/.ssh
$ cd ~/.ssh
$ vi config

Host github.com
 HostName github.com
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/projectname

$ ssh-keygen -f ~/.ssh/projectname -C "projectname"
$ pbcopy <~/.ssh/projectname.pub

Add the keygen in the ssh-keygen tab in your github account.

Go inside your project and set your current project git email developer :

$ git config user.email youremail@gmail.com
$ git config --global user.email youremail@gmail.com   (global settings example)

How to set the color visible in terminal :

$ git config --global color.ui true
Helpfull links :
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s