Git02 (ssh key to configure and use, idea configure and use Git)

1 , introduction and use Ssh Key

Ssh key Introduction

I understand that each computer will generate an ssh key, then they have a remote account, but they have probably had a lot of computers,

Including the home computer as well as the company's computers, we can work on any computer, but if you want each computer and a remote repository at all times maintain communication,

After'll need to add each computer to a remote ssh key accounts, added to the remote repository, a remote repository and will have added computers to communicate without communicating with other computers

  Recommendation: All Git operations are carried out through ssh key, because simple

Ssh key configuration

Operations are divided into local computer configuration and website configuration github

Step One: Local computer configuration

Right-space, select Git Bash Here to open the associated command window  

   1. Configure the user name and mailbox (if configured, skip)

     git config --global user.name "username"

     git config --global user.email "email"

     After it will be in C: Create a .gitconfig file \ Users under \ dell, content

[user]
    name = xxx
    email = xxx@xxx.com

   Precautions:

     Note 1: username and email that is landing github account and registered mail

     Note 2: git -global parameters config command with this parameter, all Git repository that you will use this configuration on this machine

    2. Check yourself before has not been generated ssh

     cd ~/.ssh

      ll

 

    3. Generate (or delete) keys

     ssh-keygen -t rsa -C "[email protected]" // Here's mailbox mailbox to be replaced when their registration

     3 can be followed by a carriage return.

   

 4. After the command completes, the default window in C: \ Users \ dell \ .ssh generate the following two of the following file name:

     C:\Users\dell\.ssh

        id_rsa (private, can not leak out)

       id_rsa.pub (public key)

       known_hosts (do not bother) 

 

 

Step two: Remote github repository configuration

 

 

 

 

github official website sometimes will want you to enter a password to log in to add ssh key. Enter the password

Summary: https and SSH difference:

  1. The former are free to clone project on github, regardless of who is; while the latter is that you must be the owner or administrator to clone your project, you need to add the SSH key, otherwise it can not be cloned.
  2. https url when the push is needed to verify the user name and password; and SSH push in time, do not need to enter a user name; if configured SSH key when the password is set, you need to enter a password, otherwise it does not require direct enter a password.

        Git protocol push remote repository need to fill github account password, the operation is more convenient

2.Idea configuration uses and use git

1. Set the installation path git.exe

The project idea to download from Github inside

VCS=>Checkout from Version Control =>Git

url: Copy on Github link

The project to share their Github

VCS=>Checkout into Version Control =>Share Project on GitHub

Project submission process, right-click the project, choose Git, then add is added to the staging area, Commit is submitted to the local repository, push to a remote repository is submitted

解决冲突问题
比如成员A提交了代码到远程仓库,然后成员B又想提交代码到远程仓库,就是产生冲突问题
当成员B点击Push的时候,就会弹出一个框,然后我们选择merge,进入到处理分支命令,然后继续选择merge,然后就两个成员的内容都展示出来,已中间为样板点击箭头,把两边内容都移过来就好了

 

Guess you like

Origin www.cnblogs.com/chenjiahao9527/p/11691238.html