Importing a Remote Git Repository to CodeHub
Background
CodeHub allows you to import Git-based remote repositories.
Git-based remote repositories are cloud repositories hosted in storage services such as GitHub.
Cloning the Git Repository to the Local host and Associating and Pushing It to CodeHub
Clone the remote repository to the local host, and then associate and push the repository to the cloud code hosting.
- Install and configure the Git client.
- Download a bare repository using the source repository address.
The following uses GitHub as an example:
- Open and enter the address of the GitHub code repository in a browser.
- Click Code on the right, choose the HTTPS tab, and click the Copy Icon on the right.
- Open the Git Bash client on the local host, run the following command to clone the repository to the local computer, and run the cd command to go to the repository directory:
git clone --bare <source_repository_address>
- Associate the local repository with CodeHub and push it to CodeHub.
- On the CodeHub homepage, click Create Directly. In the Permissions area, do not select Allow generation of a README file.
- Go to the repository details page created in 1, click Clone/Download, and click the Clone with SSH or Clone with HTTPS as required. Then, click to obtain the repository address.
In this example, the HTTPS address is used.
- In the root directory of local source code, open the Git Bash client and run the following command to push the local repository to the new repository:
git push --mirror <new_codehub_repository_address>
When the command is executed, the system prompts you to enter the HTTPS account and password of the CodeHub repository. Enter the correct account and password. (For details, see Obtaining an HTTPS Password.)
If your source repository has branches and tags, they will also be pushed to the CodeHub cloud repository.
- On the CodeHub homepage, click Create Directly. In the Permissions area, do not select Allow generation of a README file.
After the push is successful, check whether the migration is complete in the code hosting cloud repository. (For details, see Repository List.)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot