Two ways to associate a remote repository with a git local warehouse

Source: Internet
Author: User
Tags ssh git clone
There are two ways to associate a remote repository with a git local repository: 1. Clone the remote code to a local warehouse 2. Associating local code to a remote repository
1.git Clone Existing project (HTTPS | SSH) SSH: Check if your computer has a key to Id_rsa id_rsa.pub, create a key pair ssh-keygen-t rsa-b 4096-c "Your git settings mailbox" Check if your ssh-agent is active eval " $ (ssh-agent-s) "Add the private key to the Ssh-add ~/.ssh/id_rsa and then add the public key to the GIT website, such as GitHub

Test if you can connect ssh-t git@github.com clone to local git clone git@github.com:hongminzhang/zhm.git
2. Associate a local existing project to a new project on GitHub and create a new warehouse on GitHub and then execute git remote add Origin git@github.com:stormzhang/test.git in the local repository Origin is the name of the repository, maybe your local project is associated with several warehouses, you can submit the code to a different repository according to the name of the repository Git push Origin master, you can specify the branch and then execute GIT pull Origin master Pull down the code on GitHub and then push Origin master in git

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.