Use GitHub in Windows 10
1. Register an account
We first need to go to GitHub's official website on register an account and then create a warehouse.
2. Download and install Git for Windows
https://gitforwindows.org After the
download is complete, install it, all the way to next.
3. Configure Git
- Run Git Bash, as shown in the following figure:
- Then create an ssh key, enter the command:
$ ssh-keygen -t rsa -C "[email protected]"
Which [email protected]
is used when the mailbox registered GitHub.
- At this time, you can modify the path where the key is saved, or just press Enter without modifying it.
- Enter the password that needs to be provided each time you use the key. If you do not enter it, the password will not be used.
- The content shown in the figure below shows that the configuration has been successful.
4. Connect to GitHub
-
Find the .ssh folder you just created, open the id_rsa.pub file, and copy the contents inside.
-
Open the GitHub homepage, click on the avatar to open the drop-down menu, and select Settings
- Click on SSH and GPG keys on the left
- Click the green New SSH Key button and fill in the Title and Key in the new page. Among them, Title can be filled in at will; Key is the content just copied. Finally click "Add SSH Key".
- Open Git Bash again and enter the command:
$ ssh -T [email protected]
As shown below:
After typing yes, press Enter, and a prompt appears:
It indicates that you have successfully connected to GitHub.
5. Create a local warehouse and upload
- Open Git Bash and enter the following two lines of commands:
$ git config --global user.name "your name"
$ git config --global user.email "[email protected]"
Among them, the your name
best GitHub username [email protected]
is the email address used when registering with GitHub.
- Create a folder on the local hard disk as a local warehouse. After entering the folder, open Git Bash and enter the following command:
$ git clone https://github.com/yourName/yourRepo.git
Among them, yourName
is the user name of GitHub; yourRepo
is the name of the warehouse created on GitHub in step 1.
- After the clone is completed, there is also a folder with the same name in the local warehouse, that is, the remote warehouse.