1# Obtaining Source Code 2 3 4In the Ubuntu environment, perform the following steps to obtain the OpenHarmony source code: 5 6 7## Preparations 8 91. Register your account with Gitee. 10 112. Register an SSH public key for access to Gitee. 12 133. (Skip this step if the tools have been installed.) Install the git client and git-lfs. 14 15 Update the software source: 16 17 ``` 18 sudo apt-get update 19 ``` 20 21 Run the following command to install the tools: 22 23 ``` 24 sudo apt-get install git git-lfs 25 ``` 26 274. Configure user information. 28 29 ``` 30 git config --global user.name "yourname" 31 git config --global user.email "your-email-address" 32 git config --global credential.helper store 33 ``` 34 355. Run the following commands to install the **repo** tool: 36 37 In this example, **~/bin** is used as an example installation directory. You can change the directory as needed. 38 39 ``` 40 mkdir ~/bin 41 curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o ~/bin/repo 42 chmod a+x ~/bin/repo 43 pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests 44 ``` 45 466. Add the path of the **repo** tool to environment variables. 47 48 ``` 49 vim ~/.bashrc # Edit environment variables. 50 export PATH=~/bin:$PATH # Add the path of the **repo** tool to the end of environment variables. 51 source ~/.bashrc # Apply environment variables. 52 ``` 53 54 55## How to Obtain 56 57> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** 58> 59> Download the release code, which is more stable, if you want to develop commercial functionalities. Download the master code if you want to get quick access to the latest features for your development. 60 61- **Obtaining OpenHarmony release code** 62 63 For details about how to obtain the source code of an OpenHarmony release, see [OpenHarmony Release Notes](../../release-notes/Readme.md). 64 65 66- **Obtaining OpenHarmony master code** 67 68 Method 1 (recommended): Use the **repo** tool to download the source code over SSH. (You must have registered an SSH public key for access to Gitee.) 69 70 ``` 71 repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify 72 repo sync -c 73 repo forall -c 'git lfs pull' 74 ``` 75 76 Method 2: Use the **repo** tool to download the source code over HTTPS. 77 78 79 ``` 80 repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify 81 repo sync -c 82 repo forall -c 'git lfs pull' 83 ``` 84 85 86## Running prebuilts 87 88Go to the root directory of the source code and run the following script to install the compiler and binary tool: 89 90``` 91bash build/prebuilts_download.sh 92``` 93