Creating an Empty Repository
You can create an empty repository in the cloud and synchronize a local repository to that repository. To create an empty repository on the CodeHub console, perform the following steps:
- Go to the CodeHub repository list page.
- Click Create Directly. On the page that is displayed, enter basic repository information.
Table 1 Parameters for creating an empty repository
A name contains letters, digits, underscores (_), periods (.), and hyphens (-) and must start with a letter, digit, or underscore (_).
- A repository must be in a project.
- If you create a repository in a project, the project is selected for Project by default, and the Project parameter is hidden on the repository creation page.
- If there is no project under the account or you click Create Project in the Project drop-down list, the Create Project dialog box is displayed and you can create a basic project.
(For a basic project, only CodeHub can be used. Other services are not enabled by default. You can change a project to a basic project on the project settings page.)
Enter the description of your repository.
Programming Language of .gitignore
The .gitignore file is generated based on your selection.
Select a type for your repository content.
The options are as follows:
- Allow project members to access the repository
The project manager is automatically set as the repository administrator, and the developer is set as a common repository member. When the two roles are added to the project, they will be automatically synchronized to existing repositories.
- Allow generation of a README file
You can edit the README file to record information such as the project architecture and compilation purpose, which is similar to a comment on the entire repository.
The options are as follows:
The repository is visible only to repository members. Repository members can access the repository or commit code.
- Public read-only
The repository is open and read-only to all guests, but is not displayed in their repository list or search results. You can select an open-source license as the remarks.
- Click OK to create the repository. The repository list page is displayed.
Associating with an Existing Directory or Repository
If you do not generate a README File when creating a common repository, you can click the Files tab and click Create a README file to generate a README file or associate the repository with an existing directory or repository. The procedure is as follows:
- You need to run following commands on the Git client. Install the Git client and configure the Git global username and user email address. For details, see Git Installation and Configuration.
- Set the SSH key. For details, see SSH Keys.
The following commands have been automatically generated in the new repository. You can copy them on the Files tab page of the repository.
- Clone the repository on the local host and push the new README file.
git clone HTTP_download_address cd taskecho "# Repository_name" > README.mdgit add README.md git commit -m "add README"git push -u origin master
- Associate an existing code directory with the repository.
cd <Your directory path> mv README.md README-backup.md git init git remote add origin HTTP_download_address git pull origin master git add --all git commit -m "Initial commit" git push -u origin master
- Associate with an existing Git repository.
cd <Your Git repository path> git remote remove origin > /dev/null 2>&1 git remote add origin HTTP_download_address git push -u origin --all -f git push -u origin --tags -f
Was this page helpful?Provide feedback
For any further questions, feel free to contact us through the chatbot.Chatbot