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:
    Insert picture description here
  • 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.

Insert picture description here

  • At this time, you can modify the path where the key is saved, or just press Enter without modifying it.

Insert picture description here

  • 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.

Insert picture description here

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

Insert picture description here

  • Click on SSH and GPG keys on the left

Insert picture description here

  • 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".

Insert picture description here

  • Open Git Bash again and enter the command:
$ ssh -T [email protected]

As shown below:

Insert picture description here

After typing yes, press Enter, and a prompt appears:

Insert picture description here

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 namebest 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, yourNameis the user name of GitHub; yourRepois 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.

Guess you like

Origin blog.csdn.net/michael_f2008/article/details/83036671