Using Git client
    • PDF

    Using Git client

    • PDF

    Article Summary

    Available in Classic and VPC

    After issuing the credentials (HTTPS/SSH) to access the SourceCommit repository, you can clone the desired repository on the local PC using the credentials.

    Note
    • Update the Git client to a upper version to secure a smooth usage environment (v1.8.4.3 or later is recommended).
    • Log in to console using the SourceCommit customer account or the sub account with WRITE permissions or greater for SourceCommit management such as integrating changes or deleting repositories in console. Refer to Sub Account Guide for how to set permissions for a sub account.

    Issue Git credentials

    Issue the credentials appropriate to the connection method (HTTPS/SSH) first to access the SourceCommit repository using the Git client on the local PC.

    Note
    • The credentials for HTTPS connection can be issued only if you're logged in with a sub account.
    • If "@" symbol is included in the account name, SSH connection is not available (common in customer accounts and sub accounts).

    Set Git account for HTTPS connection

    The following describes how to set a Git account (user name/password) for HTTPS connection.

    1. Connect to the NAVER Cloud Platform console.

    2. Click the Services > Developer Tools > SourceCommit menus, in that order.

    3. Click the [Set Git account/Git SSH] button in the SourceCommit page.

    4. Click the [Set Git account] tab in the Set Git account/Git SSH pop-up window.
      sourcecommit-use_client1_ko

    5. Check the user name of the User name item in the Set account area.

      • The sub account name used when logging in to console is used as the user name.
    6. Enter the password in the Password and Confirm password fields, and then click the [Apply] button.

    Note
    • If you enter the wrong password 10 times within 1 minute when connecting to the Git client, the account is locked for 10 hours and becomes unavailable.
    • If you change the password, the account is unlocked.

    Set Git SSH connection

    The following describes how to create the Git credentials (SSH key) for SSH connection.

    Note

    If you use Windows operating system, use the Git Bash emulator.

    1. Run the Git client on the local PC, and then create a RSA key pair.

      • Enter the path and password of the key pair to be created.
        • Key pair path example: /Users/USER/.ssh/id_sourcecommit)
        • Press the Enter key to use it without passwords.
      $ ssh-keygen
      Generating public/private rsa key pair.
      Enter file in which to save the key (/Users/SourceCommit/.ssh/id_rsa): /Users/USER/.ssh/id_sourcecommit
      Enter passphrase (empty for no passphrase):
      Enter same passphrase again:
      
      Your identification has been saved in /Users/USER/.ssh/id_sourcecommit.
      Your public key has been saved in /Users/USER/.ssh/id_sourcecommit.pub.
      
      The key fingerprint is:
      
      SHA256:oHdc0iQA7I25CvtEwmgzBHIalk67UgKHyygw0fihDl8 USER@0000000000
      The key's randomart image is:
      +---[RSA 2048]----+
      |        o++o*.   |
      |        .*oX.+   |
      |       .*.O.+. . |
      |        .=.o+.=  |
      |        SooBo* . |
      |        ..+o+ +.o|
      |         E    .+o|
      |        .      =o|
      |              o.=|
      +----[SHA256]-----+
      
    2. Copy the public key of the created key pair to the clipboard.

      $ cat /Users/USER/.ssh/id_sourcecommit.pub
      
      ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCtEtEm+UQfHJtSEaNS/Q4tnrOGWu12qHyaIbZGk5A/OzmxDvmUeJRyiVz0/49MPElDLk/HbnZUx5joZskqVpyzrbF12YT7IweUkWWYie4bZ/c8dwQUi9yjgE5NUs0m5xPxq/u1QfMySLEOwvat8e0V2dpt7p0XeZB7QaMM+sexP+78EtUa3PD60Vko++2oPpK7ze5DdYduQAIiRVbC5NWpRLbHrhsXYScPU537jDqtRp3pXUXlpEUcVADXffD4Mer7PTGXr1NrJMefeisFRev4oQ4dtcQU3KmTxDK1nZeIGRB92NwsEvXI6FEF3jRD+sk+stq8ZEJe23Iyg0Gs6K1 USER@xxxxxxxx
      
    3. From the NAVER Cloud Platform console, click the Services > Developer Tools > SourceCommit menus, in that order.

    4. Click the [Set Git account/Git SSH] button in the SourceCommit page.

    5. Click the [Set Git SSH] tab in the Set Git account/Git SSH pop-up window.

    6. Paste the copied public key to the Register SSH public key area, and then click the [Register] button.
      sourcecommit-use_client2_ko

      • SSH key item is shown in the Registered SSH public key area.
        sourcecommit-use_client2a_ko
      • The SSH public key's SSH key item value is used as the User name when connecting to SSH (value of User item when creating the config file).
    7. Refer to the following example to create a config file in the path where the public key is saved in the local PC's Git client.

      • Enter the SSH public key's SSH key item value as the User item's value.
      $ vi ~/.ssh/config
      Host devtools.ncloud.com
      User [SSH key value registered in console]
      IdentityFile ~/.ssh/id_sourcecommit
      

    Clone repository

    You can copy the SourceCommit repository's Git URL from NAVER Cloud Platform console, and then clone the SourceCommit repository by using the Git client on the local PC.

    Clone repository by HTTPS connection

    The following describes how to clone a repository by using HTTPS connection.

    Note

    Issue the HTTPS credentials first to clone the SourceCommit repository through HTTPS connection. Refer to Set Git account for HTTPS connection for details.

    1. Connect to the NAVER Cloud Platform console.
    2. Click the Services > Developer Tools > SourceCommit menus, in that order.
    3. Select a repository from the SourceCommit page, and then click the [Go to code] button.
      • You can also click the repository name from the repository list.
    4. Click the [CLONE URL] button, and then click the [HTTPS] tab in the Repository's detailed features page.
    5. Check the Git URL in the Clone with HTTPS area, and then click the [Copy] button to copy it to the clipboard.
      sourcecommit-use_client3_ko
    6. Run the Git client on the local PC, and then clone the repository as follows.
      • When the Enter account information window is shown, enter the account information set during the Set Git account for HTTPS connection step.
      • The replica of the repository is created on the local PC.
      $ git clone [https Git URL, example: https://devtools.ncloud.com/**********.git]
      
      Note
      • If you enter the wrong password 10 times within 1 minute when connecting to the Git client, the account is locked for 10 hours and becomes unavailable.
      • If you change the password, the account is unlocked.

    Clone repository by SSH connection

    The following describes how to clone a repository by using SSH connection.

    Note

    You should register the SSH key first, and then create a config to clone the SourceCommit repository through SSH connection. Refer to Set Git SSH connection for details.

    1. Connect to the NAVER Cloud Platform console.

    2. Click the Services > Developer Tools > SourceCommit menus, in that order.

    3. Select a repository from the SourceCommit page, and then click the [Go to code] button.

      • You can also click the repository name from the repository list.
    4. Click the [CLONE URL] button, and then click the [SSH] tab in the Repository's detailed features page.

    5. Check the Git URL in the Clone with SSH area, and then click the [Copy] button to copy it to the clipboard.
      sourcecommit-use_client4_ko

    6. Run the Git client on the local PC, and then clone the repository as follows.

      • The replica of the repository is created on the local PC.
       $ git clone [SSH Git URL, example: ssh://devtools.ncloud.com/**********.git]
      
      Note
      • If you're using multiple SSH keys, you can perform SSH connection by using a certain SSH key like in the following example.

        $ git clone ssh://[Certain SSH key]@devtools.ncloud.com/123/**********.git
        
      • If the following error occurs, add the settings to the config file by referring to the example.

        $ git clone ssh://devtools.ncloud.com/123/************.git 1108
        Cloning into '1108'...
        Unable to negotiate with 211.249.59.23 port 22: no matching host key type found
        Their offer: ssh-rsa
        fatal: Couls not read from remote repository.
        
        Please make sure you have the correct access rights and the regpository exists.
        

        config file modification example (added the last 2 rows)

        $ vi ~/.ssh/config
        Host devtools.ncloud.com
        User [SSH key value registered in console]
        IdentityFile ~/.ssh/id_sourcecommit
        HostkeyAlgorithms +ssh-rsa
        ​PubkeyAcceptedAlgorithms +ssh-rsa
        

    Upload (push) files from local PC

    After adding, deleting, or changing the SourceCommit's file cloned on the local PC, you can upload (push) to the remote repository (SourceCommit repository) by using the Git client.

    This guide describes how to upload (push) to the remote repository after creating a commit for all changes of the local repository with a simple example. Refer to Official Git document for details about each Git command and various options that can be used together.

    The following describes how to upload the local repository's changes to the SourceCommit repository.

    1. Change the file within the repository cloned during the Clone repository step on the local PC.

      • You can modify, add, or delete a file.
    2. Run the Git client, reset the repository by referring to the following example, and then create a commit for all changes.

      • Reset local repository
        $ git init
        
      • Add all changes to commit
        $ git add -A
        
      • Creating commit
        $ git commit -m "Local changes"
        
        [master cb587d8] Local changes
        10 files changed, 76 insertions(+), 1 deletion(-)
        create mode 100644 Testscript_001.md
        create mode 100644 Testscript_002.md
        create mode 100644 Testscript_003.md
        create mode 100644 Testscript_004.md
        create mode 100644 Testscript_005.md
        create mode 100644 Testscript_006.md
        create mode 100644 Testscript_007.md
        create mode 100644 Testscript_008.md
        create mode 100644 list.bat
        
    3. Upload (push) the changes committed to the local repository to the SourceCommit repository.

      • Once the upload is completed, you can check the changed file and commit history in the SourceCommit repository.
      $ git push
      
      Enumerating objects: 7, done.
      Counting objects: 100% (7/7), done.
      Delta compression using up to 8 threads
      Compressing objects: 100% (5/5), done.
      Writing objects: 100% (5/5), 1.64 KiB | 1.64 MiB/s, done.
      Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
      To https://devtools.ncloud.com/******/sample001.git
      7155f8d..cb587d8  master -> master
      

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.