Cloning an Oracle Developer Cloud Service Project Git Repository Using a CLI


Options



Before You Begin

Purpose

In this tutorial, you'll learn how to clone an Oracle Developer Cloud Service project Git repository on your local system using a command-line interface (CLI).

Time to Complete

Approximately 15 minutes

Background

After you create an Oracle Developer Cloud Service project using the Oracle Developer Cloud Service user interface, you'll want to clone the Git repository to your local system so that you can populate it with your own application or applications. You can use an IDE to do this, or you can use Git Bash or another command-line interface.

Context

This tutorial assumes you have completed the OBE tutorial Creating an Oracle Developer Cloud Service Project.

What Do You Need?

  • A login to an Oracle Developer Cloud Service instance

  • One of the following supported browsers:

    • Chrome 48 or later (also for Android)
    • Firefox 38 or later
    • Internet Explorer 11 or 12
    • Safari 7 or 8 (Mac OS)
    • Safari Mobile 5 (iOS)
  • A local installation of Git

Cloning an Oracle Developer Cloud Service Project

  1. Launch your Oracle Developer Cloud Service, following the instructions in "Accessing Oracle Developer Cloud Service Using the Web Interface" in Using Oracle Developer Cloud Service.

  2. Provide your identity domain, user name, and password, and click Sign In. Then, from the My Services Dashboard, click Open Service Console for the Developer service.

  3. On the Welcome page, click the project you created in the tutorial Creating an Oracle Developer Cloud Service Project.

    Welcome page
    Description of this image
  4. On the Project page, click the Code tab. (You can click the Show/Hide Labels icon to hide the labels.)

    First page of New Project wizard
    Description of this image

    The Code page provides instructions on how to clone the Git repository, including sample command lines.

    First page of New Project wizard
    Description of this image
  5. On your home system, open a command window that provides access to Git commands, such as Git Bash. Change to the location where you want to clone the project.

  6. Copy the git clone command line from the browser and paste it into the command window. Your command line will have its own service URL, organization name, and project name. You will be asked for your password. The warning means only that the repository is empty, so don't be alarmed.

    $ git clone https://alex.admin@service-url/org-name/s/org-name_project-name/scm/project-name.git
    Cloning into 'project-name'...
    Password for 'https://alex.admin@service-url':
    Checking connectivity... done.
    warning: remote HEAD refers to nonexistent ref, unable to checkout.
  7. Change to the project directory and create an empty README file to populate the repository.

    $ cd basic-project
    $ touch README.md 
  8. Add all the files to the commit list. (There is only one at present.)

    $ git add -A .
  9. (Optional) Get a list of the files to be committed.

    $ git status
    On branch master
    
    Initial commit
    
    Changes to be committed:
      (use "git rm --cached <file>..." to unstage)
    
            new file:   README.md
  10. Commit the files, adding a commit message.

    $ git commit -m "Initial commit"
  11. Push the files to the remote repository. You'll be asked for your password again.

    $ git push -u origin master
    Password for 'https://alex.admin@service-url':
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 234 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: Updating references: 100% (1/1)
    To https://alex.admin@service-url/org-name/s/org-name_project-name/scm/project-name.git
     * [new branch]      master -> master
    Branch master set up to track remote branch master from origin.
  12. In the browser, click the Code tab again to view the committed project file.

    First page of New Project wizard
    Description of this image
  13. You can now go on to populate the repository by copying an application on your local system into it, then committing and pushing it.

Want to Learn More?