GitHub learning Experience installation configuration and multi-account management

Source: Internet
Author: User

GitHub learning Experience installation configuration and multi-account management

1. Preface
2.GitHub Linux Installation (Ubuntu)
3. Account 1 Configuration
4. Account 2 Configuration
5. Local administration

First, preface

This blog post records the installation configuration and multi-account management for GitHub.

This article is based on the following articles:
Http://www.runoob.com/w3cnote/git-guide.html (Github simple tutorial)
http://m.blog.csdn.net/article/details?id=41824339 (How to use two github accounts on a single computer)
Http://www.tuicool.com/articles/zqa6Rz (How to use two github accounts on a single computer)
http://achillessatan.github.io/2016/01/29/2016012902/("GitHub" uses multiple github accounts on a single computer)
Http://www.tuicool.com/articles/7nMBVf (SSH key switch for multiple github accounts)
Http://blog.sina.cn/dpool/blog/s/blog_700aa8830101kdp3.html?vt=4 (Getting Started with Git and GitHub Warehouse management projects under Windows)
http://m.blog.csdn.net/article/details?id=9114501 (GitHub new local warehouse, remote warehouse basic usage)
http://m.blog.csdn.net/article/details?id=27706679 (GitHub detailed tutorial)
http://m.blog.csdn.net/article/details?id=11651229 (the most GitHub tutorial in the history of GitHub: Getting started with GitHub to mastering)

Second, GitHub Linux installation (Ubuntu)

On Ubuntu, you can install the GIT command line tool via apt

sudo apt-get install Git-core

Third, account number 1 configuration

1. Create an SSH key locally:

Ssh-keygen-t rsa-c "[Email protected]"

The following [email protected] Changes to the mailbox registered on GitHub, and then asks for a confirmation path and password, using the default return line.
Successful words will be generated under ~/. SSH folder, go in, open id_rsa.pub, copy the key inside.
Go back to GitHub, go to account Settings, choose SSH keys,add ssh key,title on the left, and paste the Key generated on your computer.


2. In order to verify success, enter:

ssh-t [email protected]

If it is the first time will prompt whether continue, enter Yes will see: You ' ve successfully authenticated, but GitHub does not provide shell access. This means that you have successfully connected to GitHub.

Iv. Configuration of Account 2

1. Generate SSH Key for account 2

Ssh-keygen-t rsa-c "Your-email-address"

#存储key的时候, do not overwrite the existing ID_RSA, use a new name, such as Id_rsa_work

2. Add id_rsa_work.pub to your work account

3. Add the key to the SSH agent. Because the default. Ssh/id_rsa is not used, you need to display the location of the new key that tells the SSH agent your

$ Ssh-add ~/.ssh/id_rsa_work

# You can confirm the results with ssh-add-l.

4. Configuration. Ssh/config
Add the following content

#default GitHub
Host github.com
HostName github.com
Identityfile ~/.ssh/id_rsa

Host Github_work
HostName github.com
Identityfile ~/.ssh/id_rsa_work

5. In this case, you can use the github.com alias github_work to make it clear that if you use Id_rsa_work SSH key to connect to GitHub, use your work account.

#本地建库
$ git init
$ git commit-am "first commit"

#push到github上去
$ git Remote add origin [email protected]_work:xxxx/test.git
$ GIT push origin master

V. Local Management

#本地建库
$ git init
$ git commit-am "first commit"
$ git clone [email protected]_work:xxxx/test.git

#push到github上去
$ git Remote add origin [email protected]_work:xxxx/test.git
$ GIT push origin master

For more information, please refer to the article: http://gitref.org/zh/remotes/(Git reference manual)

Note:

Execute under the account corresponding file

$ git config user.name [sub_account.user_name]
$ git config user.email [sub_account.email]

GitHub learning Experience installation configuration and multi-account management

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.