Home > Article > Development Tools > How to use Gitee on Apple systems
With the continuous development of large-scale development technology, programmers often need to use code hosting platforms during the development process. Git is one of the most popular version management systems. Many developers like to host their code on GitHub, but for some reasons, some users may not want to use GitHub, a US-based website. For this reason, there is a very popular code hosting platform in China, and that is Gitee. In this article, we will introduce how to use Gitee on Apple systems.
1. Register and log in to Gitee
First, you need to register an account on the Gitee platform. If you already have a Gitee account, you can log in directly. After logging in, select the warehouse where the code needs to be placed and create a new warehouse.
2. Install Git in the terminal
The Apple system comes with Git. If there is no Git command on your system, you can install it in the terminal through the following command:
$ xcode-select --install
3. Create SSH key
In order to securely log in via ssh on Gitee, you need to generate an SSH key in the terminal. Execute the following command in the terminal:
$ ssh-keygen -t rsa -C "your_email@example.com"
Replace "your_email@example.com" with your email address. After executing this command, it will be saved in the /Users/username/.ssh/ directory by default. id_rsa is the private key file and id_rsa.pub is the public key file.
4. Add the SSH key to Gitee
After logging in to Gitee, find "Settings" under "Avatar" in the upper right corner, then find "SSH Public Key" and add it. Copy the public key file generated in the previous step there and save it.
5. Clone the code to local
Select the warehouse to be cloned on the Gitee platform and copy its SSH remote address. Use the cd
command in the terminal to enter the local directory where you want to store the code, then copy the following command and execute it:
$ git clone git@gitee.com:username/repositoryName.git
Among them, the user name and warehouse name need to be replaced by yourself. After executing this command, the code will be cloned to the current directory.
6. Change the file
Use your favorite text editor to open the code you cloned and make the edits you want. Once you have made changes to your code and saved them, you need to commit them using Git.
7. Submit changes
Still in the terminal, enter the code directory and use the following command to submit the changes to the warehouse:
$ git add . $ git commit -m "your message" $ git push origin master
Among them, git add
The command adds all files in the current directory to the local cache, git commit
The command commits the changes in the cache to the local warehouse and adds a descriptive message to the submission, git push
Command to push changes from the local warehouse to Gitee.
Summary
Through the above seven steps, you have mastered the basic method of using Gitee on Apple systems. Of course, in addition to basic Git commands, the Gitee platform also provides many other functions to help you better manage your code. If you are new to Gitee, you can learn more about code hosting and version control through its official website.
The above is the detailed content of How to use Gitee on Apple systems. For more information, please follow other related articles on the PHP Chinese website!