1. Open the terminal in macos, type cd ~/.ssh, if it prompts that the directory does not exist, create it (mkdir .ssh);
2. Type ls, Check the files in this directory. If you see id_rsa.pub or id_dsa.pub in it, it means you have already created it. Skip the following creation steps. If not, perform the following creation;
3. Type Enter ssh-keygen -t rsa -C "YOUR EMAIL", and then it will prompt you to enter the file name. You can enter it directly without inputting it, then enter the password, press Enter, enter the password again to confirm, write down the password here, and submit It is needed;
4. After the above creation, an id_rsa.pub or id_dsa.pub file will be generated in the .ssh directory. Use the cat command to view the contents (cat id_rsa.pub) , copy this content;
5. Log in to github.com, enter the settings interface from the account settings in the upper right corner, find SSH keys, click Add SSH key, the Title can be named by yourself, and the key pastes the id_rsa.pub above content of the file, click Add key;
The configuration is basically completed here, let’s create a repo
6. Go to github.com, click Create New Repository to create a new library , copy the ssh address;
7. Return to Xcode, click Source Control--"YOUR Project"--Config..., open the configuration dialog box, select the remote tab, and add in the lower left corner of the store button, add remote..., set the Name yourself, paste the above ssh address in Address, click Add remote to return;
8. Click Source Control--Push..., click push after the load branch is completed , you will be prompted to enter the password, enter the password in the third step, and you are done;