Local git and github bind to upload local repository GitHub

premise

  1. Git is already installed git installation steps
  2. Registered GitHub GitHub registration

Ssh key first step in creating a local

  1. Open the git-bash.exe


  2. Enter in the window ssh-keygen -t rsa -C "注册GitHub的邮箱地址"
  3. The following text appears after clicking enter, meaning that requests a path to save the key. We can directly enter the program will be the key saved in the default path
  4. The following text appears after clicking enter, which means to set a password. If you choose to set a password needed to confirm the password. If do not want to set a password, you can directly enter twice
  5. As a last appears to indicate that key has been generated
  6. File path shown in the drawing, open the path to the file Explorer. Under the document plus id_rsa.pub it is that we have to get the key.


  7. Open a text file id_rsa.pub , get key.

The second step configuration github

  1. Log into the setting GitHub
  2. Click on SSH and GPG keys and click the New SSH key
  3. title bar title key, you can customize. key key column needs to be obtained in the first paste it here, then click add SSH key.
  4. GitHub need to enter the password to confirm the addition SSH key click add SSH key.
  5. Add the following situations represent key success on GitHub.

The third step is to configure local git

  1. Verify that local git and GitHub binding is successful
    input in the git-bash ssh -T [email protected] and then click OK. The first execution of the instruction will be prompted to continue, you need to enter yes.
  2. Enter yes and press Enter If there You've successfully authenticated, but GitHub does not provide shell access. is success binding.
  3. Set the user name and login email
    git config --global user.name 'username'
    git config --global user.email 'login E-mail'

Associated with the creation and submission of the fourth step GitHub repository local repository

  1. The need to create a file repository folder, right-select option git bash here.
  2. Creating a warehouse
    entered in the window that opens git init
  3. Add all the files to the repository
    in the input window that opens git add . , and then enter all documents submitted to the repository.
  4. GitHub repository to create
    the new repository on GitHub Home login click the New button.
    Set up the warehouse name, create a readme file and then click Create repository

  5. Warehouse SSH key acquisition
    After creating warehouses, click Clone or download button warehouse page, and then copy the SSH key.
  6. Local warehouse and associated GitHub repository
    at git-bash open the window, enter git remote add origin 第5步获取的仓库的SSH key add all the files to the repository
  7. Submitted to the local repository GitHub
    enter the git-bash at the open window, git pull --rebase origin master the local warehouse and synchronous remote repository, and then enter git push -u origin master to submit to the local repository GitHub
  8. Synchronization is complete.

Guess you like

Origin www.cnblogs.com/realZhaZhaHui/p/12509543.html
Recommended