Git Github repository based on the use of remote quick check

Git Github repository based on the use of remote quick check

Configuring authentication information

Since the transmission between local Git repository and GitHub repository through SSH encryption, so we need to configure the authentication information:

  • SSH Key generation using the following command:

    $ ssh-keygen -t rsa -C "[email protected]"
    

    Back [email protected] changed your mailbox registered on Github, you'll be asked to confirm the path and enter your password, we use the default way to enter it on the line. Successful will generate .ssh folder ~ / down, go in, open id_rsa.pub , copy inside Key .

  • Back on Github, => after Settings (account configuration) into the Account:

    Left select SSH and GPG Keys , and then click New SSH key buttons, title set title, can easily fill, paste in your key generated on the computer.

  • Verify successful, enter the following command:

    $ ssh -T [email protected]
    
  • Click on GitHub "New repository", create a warehouse. For example, git-test.

2. Add a remote repository

  • Add a new remote Git repository:

    $ git remote add <shortname> <url>
    

    E.g:

    $ git remote add origin [email protected]:tianqixin/git-test.git
    

3. Check the remote repository

  • View remote repository server is already configured:

    $ git remote
    
  • You can specify options -v, read and write will show the need to use Git remote repository shorthand to save the corresponding URL:

    $ git remote -v
    

4. The gripping and pulling from a remote repository

  • Obtaining data from a remote repository, you can do:

    $ git fetch <remote-name>
    

    This command accessing a remote repository, pull data from all of you have not. After the execution is complete, you will have to refer to all branches of the remote repository, you can merge or view at any time.

    Care must be taken git fetchcommand will pull data to your local repository - it does not automatically merge or modify your current job. When you are ready you must manually merge them into your work.

The push to a remote repository

  • When you want to share your project, it must be pushed to the upstream:

    $ git push <remote-name> <branch-name>
    

    For example: When you want to push your master branch to originthe server, then run this command to back up your server to be made:

    $ git push origin master
    

6. Review a remote warehouse

  • If you want to see more information on a remote repository, you can use:

    $ git remote show <remote-name>
    

    E.g:

    $ git remote show origin
    

7. Remove and re-naming of a remote repository

  • If you want to rename a reference name can be run:

    git remote rename 
    

    For example: you want to pbrename paul, you can do so by:

    $ git remote rename pb paul
    
  • Removing a remote repository:

    $ git remote rm paul
    
Published 33 original articles · won praise 73 · views 2787

Guess you like

Origin blog.csdn.net/weixin_46124214/article/details/104127930