Ceritanya lagi dokumentasiin git

How to generate ssh key on ubuntu

 

  1. First step we have to create the key pair  on our machine , here is the command

> ssh-keygen -t rsa -C “muhamadabi.wardani@inmagine.com

 

  1.  After thats command, you can just press Enter to continue process

> Enter file in which to save the key (/Users/abiewardani/.ssh/id_rsa): (just press enter)

 

  1. You have to type a passphrase :

 

> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again then enter]

 

  1. After you type  a passphrase , you’ll given the fingerprint, or id of your SSH key. the enter key generation process should be like this

 

> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abiewardani/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/abiewardani/.ssh/id_rsa.
Your public key has been saved in /home/abiewardani/.ssh/id_rsa.pub.
The key fingerprint is:
4a:dd:0a:c6:35:4e:3f:ed:27:38:8c:74:44:4d:93:67 muhamadabi.wardani@inmagine.com
The key’s randomart image is:
+–[ RSA 2048]—-+
|          .oo.   |
|         .  o.E  |
|        + .  o   |
|     . = = .     |
|      = S = .    |
|     o + = +     |
|      . o + o .  |
|           . o   |
|                 |
+—————–+

 

 

  1. Add your generated SSH key to the ssh-agent:

 

> ssh-add ~/.ssh/id_rsa

 

  1. Add your SSH key to your account

 

> gedit ~/.ssh/id_rsa.pub

 

and copy it , the generate string should be like this

 

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJ3yCKJeAIzKCWwaB2zzl4TnavkiVfFf/VR1P3tlJnmulT5nBoGhdMdzyPR14bq8QIGk0P0E8SbQaPmewZgaIwSKtXbC8bRjSc3GYJO1EzKAIvh7cdJD0YZLb5SyBM/5iSrgMDkIB/pY1mWvoWH17wIqWbS+2nWZZf1eig2qlk6CfYZ231hZV7yz36G+2sLFwaxXY7QojkIOnasMrqJqEQXWY4L3Yz7xHM1GB1x4F0cuXlMkL5YfcpSoY1KHk0nCIEHw/s1OVYH5lCYH6YJ6AlDECXOiJgi2tYEgOfXkgtGHh9r0PEeZllulZ8a5sVYFQjBKdvWmqAv9TBXW/N9OMZ muhamadabi.wardani@inmagine.com

 

  1. Go to gitlab , click profile setting. on the sidebar click ssh key menu. and add ssh key.

 

 

  1. Create folder probies-may

 

> mkdir probies-may

 

  1. Go to the folder probies-may

> cd probies-may

 

  1. You have to init the git using this command

 

> git init

 

  1. And we can clone the repository

 

> git clone git@54.251.105.111:arifikri/probies-may.git

 

 

Push and commit to repository

  1. First, you should add origin using this command

 

> git remote add origin git@54.251.105.111:arifikri/probies-may.git

 

  1. Create file muhamad_abi_wardani.txt using this command

 

> touch muhamad_abi_wardani.txt

 

  1. open using nano

> nano muhamad_abi_wardani.txt

 

  1. Fill this file and save it

 

Nama : Muhamad Abi Wardani

TTL : Bogor 16 Juni 1990

Kantor sebelumnya : Web Application Developer at Vox Teneo Indonesia

Alamat Sekarang : Sarijadi Bandung

 

  1. Check using git status

 

> git status

 

  1. You have to add file muhamad_abi_wardani.txt

 

> git add muhamad_abi_wardani.txt

 

  1. and then you can push to repository

 

> git push -u origin master

 

 

What if when conflict happen?

 

  1. You can using meld tools to merge file

 

> git mergetool -t meld

 

  1. And merging the conflict file
  2. Commit file

 

commit -m “merge conflict file”

 

  1. Push to repository

git push -u origin master

 

 

Days two

 

Scenario,

  1. We have to create new branch using your name, in this case i give name of the branch name muhamad_abi_wardani.

Command : git checkout -b muhamad_abi_wardani

 

  1. Edit file joel_test.txt, with your name

 

  1. Add file joel_test.txt

Command : git add joel_test.txt

 

  1. Commit the changing to the branch muhamad_abi_wardani

Command : git commit -m “edit joel test use your name”

 

  1. Push muhamad_abi_wardani to origin

Command : git push -u origin muhamad_abi_wardani

 

  1. Checkout to master

Command : git checkout master

 

  1. Merge with muhamad_abi_wardani

Command : git merge –no-ff muhamad_abi_wardani

 

  1. Push to master

Command : git push -u origin master

 

Delete Branch

 

Scenario,

 

  1. We have to delete branch muhamad_abi_wardani on local and remote repository

Command : git push origin –delete muhamad_abi_wardani

 

 

Git stash

 

Now, we want to playing with stash, the scenario is all team has to change joel_text.txt with different content.

 

1.Edit the file joel.txt using the contents of which has been determined

 

> nano joel_text.txt

 

  1. Save thats change using git stash and rename it

 

> git stash save “abi save no 6

 

  1. You can see the list of stash using this command

 

> abiwardani@inmagine-Lenovo-H530s:~/Documents/probies-may$ git stash list

> stash@{0}: On master: abi save no 6

 

  1. If you want to know, the content of stash. You can using this command

 

>  git stash show -p stash@{0}

 

  1. The difference git pop and git stash is when you using git pop, joel_test.txt will reset to your git stash content and delete your stash. If you using git apply , joel_test.txt will take the stash@{0} content without delete the stash, and we can do another commit with it.
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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s