Copy a Git File/Repository's URL

From the Git page, you can copy and share the URL of a Git repository, a file in the Git repository, or a line in a file in the Git repository.

Before you share the URL, remember that only project members can use the URL to access the file or clone the repository. If the project is shared, organization members can also access files in the project’s repository or clone the repository, but they can’t update them.

These are the copy URL actions you can perform from the Git page:

Action How To

Copy a Git repository's URL

To clone a Git repository or to access it using a Git client, you use the URL of the repository. You can copy the URL from the Project Home page's Repositories tab, the Git page, or from the Project Settings : Repositories page.

In the Project Home page's Repositories tab or the Project Settings : Repositories page, search for the Git repository, and click the Clone drop-down list to see the HTTPS and SSH URLs of the repository. To the right of the URL, click Copy the Copy icon (or select the URL and press Ctrl + C or use the mouse context menu) to copy the URL to clipboard.

Note:

Git over HTTPS works if your cloud account uses federation with Oracle Identity Cloud Service. If you are federating with other identity providers, such as Microsoft Azure Active Directory or Microsoft Active Directory, Git over HTTPS won't work. We recommend using Git over SSH instead, when you use federation with identity providers other than Oracle Identity Cloud Service.

The SSH URL of an external Git repository isn’t available.

Copy the URL of a file in the Git repository

In the Files view of the Git page, open the file. From the address bar of the browser, copy the URL.

Copy the URL of a line in a file in the Git repository

In the Git page's Files view, open the file. On the left side of the line, in the number column, click the line number. The entire line is selected. From the address bar of the browser, copy the URL.

Example: To copy the URL for line number 2 in myfile.txt, click the line number 2. Clicking the line number updates the URL in the browser’s address bar to http://developer.us2.oraclecloud.com/my-org/#projects/demo/scm/demo.git/blob/myfile.txt?revision=main&sl=2. You can copy and use this URL to open myfile.txt in the demo.git repository – main branch with line number 2 selected.

Copy the URL of a group of lines in a file in the Git repository

In the Files view of the Git page, open the file. On the left side of the line, in the number column, click the line numbers with the Shift key pressed to select them. From the address bar of the browser, copy the URL.

Example: With the Shift key pressed, clicking line numbers 2 through 5 of myfile.txt selects those lines. The URL in the browser’s address bar changes to http://developer.us2.oraclecloud.com/my-org/#projects/demo/scm/demo.git/blob/myfile.txt?revision=main&sl=2–5. Copy the URL and share it with project members. When the URL is entered, the myfile.txt file of the demo.git repository – main branch opens with line numbers 2 through 5 selected.