Using Git client
    • PDF

    Using Git client

    • PDF

    Article summary

    Available in Classic and VPC

    After you issue your credentials (HTTPS/SSH) to access SourceCommit repository, you can replicate (clone) your desired repository to a local PC using your credentials.

    Note
    • For the best use of SourceCommit, update your Git client to the latest version (v1.8.4.3 or higher is recommended).
    • To perform SourceCommit management, such as merging changes in the console or deleting repositories, log in to the console with a SourceCommit customer account or a sub account that has WRITE or higher permissions. For more information on sub accounts, see Sub Account user guide.

    Issuing Git credentials

    To access SourceCommit repository using a Git client on your local PC, you must issue credentials that match your access method (HTTPS/SSH) first.

    Note
    • You can issue Git credentials for HTTPS access only if you are logged in with a sub account.
    • If your account name contains the @ symbol, you cannot use SSH access, regardless of customer account or sub account.

    Setting Git account for HTTPS access

    To set a Git account (username/password) for HTTPS access, follow these steps:

    1. Access NAVER Cloud Platform console.

    2. Click Services > Developer Tools > SourceCommit, in order.

    3. Click the [Set GIT account/GIT SSH] button on SourceCommit screen.

    4. Click the [Set GIT account] tab from the Set GIT account/GIT SSH popup window.
      sourcecommit-use_client1_ko

    5. In the account settings area, check the username in the Username area.

      • The sub account name you used to log in to the console is your username.
    6. Enter your password in the Password and Confirm password fields, and then click the [Apply] button.

    Note
    • If you try accessing the Git client but enter the wrong password 10 times within 1 minute, the account will be locked for 10 minutes and you cannot use it during that time.
    • You can unlock the account by changing its password.

    Setting GIT SSH access

    To generate Git credentials (SSH key) for SSH access, follow these steps:

    Note

    If your operating system is Windows, use Git Bash emulator.

    1. Run the Git client on your local PC and generate an RSA key pair.

      • Enter the path and password for the key pair you generate.
        • Example of key pair path: /Users/USER/.ssh/id_sourcecommit)
        • To use the key pair without a password, press Enter.
      $ 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 generated 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 NAVER Cloud Platform console, click Services > Developer Tools > SourceCommit, in order.

    4. Click the [Set GIT account/GIT SSH] button on SourceCommit screen.

    5. Click the [Set GIT SSH] tab from the Set GIT account/GIT SSH popup window.

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

      • The SSH Key appears in the Registered SSH public key area.
        sourcecommit-use_client2a_ko
      • The SSH key value of the SSH public key is used as the User name during SSH access (as the value of the User when you create the config file).
    7. Refer to the following example and create a config file in the path where the public key is stored on your local PC's Git client (/Users/USER/.ssh/).

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

    Replicating (clone) a repository

    You can replicate a SourceCommit repository by copying the Git URL from NAVER Cloud Platform console and then using the Git client on your local PC.

    Replicating a repository via HTTPS access

    To replicate a repository via HTTPS access, follow these steps:

    Note

    To replicate a SourceCommit repository via HTTPS, you must issue HTTPS credentials first. For more information, see Setting Git account for HTTPS access.

    1. Access NAVER Cloud Platform console.

    2. Click Services > Developer Tools > SourceCommit, in order.

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

      • You can also click the repository name from the repository list.
    4. From the repository's detailed function screen, click the [CLONE URL] button and then the [HTTPS] tab.

    5. Check the Git URL from the Clone with HTTPS area and click the [Copy] button to copy it to the clipboard.
      sourcecommit-use_client3_ko

    6. Run the Git client on your local PC and replicate the repository as follows:

      • Once you see the window to enter your account information, enter the account information you set in the Setting Git account for HTTPS access step.
      • The replicated repository will be created on your local PC.
      $ git clone [https Git URL, example: https://devtools.ncloud.com/**********.git]
      
      Note
      • If you try accessing the Git client but enter the wrong password 10 times within 1 minute, the account will be locked for 10 minutes and you cannot use it during that time.
      • You can unlock the account by changing its password.

    Replicating a repository via SSH access

    To replicate a repository via SSH access, follow these steps:

    Note

    To replicate a SourceCommit repository via SSH, you must register your SSH key and create the config file first. For more information, see Setting GIT SSH access.

    1. Access NAVER Cloud Platform console.

    2. Click Services > Developer Tools > SourceCommit, in order.

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

      • You can also click the repository name from the repository list.
    4. From the repository's detailed function screen, click the [CLONE URL] button and then the [SSH] tab.

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

    6. Run the Git client on your local PC and replicate the repository as follows:

      • The replicated repository will be created on your local PC.
       $ git clone [ssh Git URL, example: ssh://devtools.ncloud.com/**********.git]
      
      Note
      • If you're using multiple SSH keys, you can use a specific SSH key to access via SSH as shown in the following example.

        $ git clone ssh://[specific SSH key]@devtools.ncloud.com/123/**********.git
        
      • If you see the following error, add 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.
        

        Example of editing config file (add 2 rows at the end)

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

    Uploading files from local PC (push)

    After you add, delete, or edit files in SourceCommit repository replicated to your local PC, you can use the Git client to upload (push) the changes to the remote repository (SourceCommit repository).

    This user guide describes how to create a commit for all changes in the local repository and upload (push) them to the remote repository, with a brief example. For more information on each Git command and the various options you can use with them, see Official Git documentation.

    To upload changes to the local repository to SourceCommit repository, follow these steps:

    1. Make changes to the files in the repository you replicated during the Replicating a repository step on your local PC.

      • You can edit, add, or delete files.
    2. Run the Git client and follow the example below to initialize the repository and create a commit for all changes.

      • Initializing a local repository
        $ git init
        
      • Adding all changes to the commit
        $ git add -A
        
      • Creating a 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 you committed on the local repository to SourceCommit repository.

      • Once the upload is complete, you can check the changed files and commit history in 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.