Github multi-account multi-project management configuration tutorial

Source: Internet
Author: User
Tags aliyun

Next, let's take a look at the Github multi-account multi-project management configuration tutorial. I hope this tutorial will be helpful to everyone.

Multiple repositories are created on Github and each repository uses an independent deploy key. As a result, when performing the git push operation, the system prompts that you do not have the permission. The error message is similar:

ERROR: Permission to quyun/php-backend.git denied to quyun/aliyun-api-tools

This error was mentioned in official help:

Https://help.github.com/articles/error-permission-to-user-repo-denied-to-user-other-repo

However, for many application scenarios, using a global key does not meet the requirements.

In a simple analysis, we can find that the ssh client is similar:

Git@github.com: quyun/aliyun-api-tools.git

The user and host in the git address are used to identify which local private key is used.

Obviously, if the user and host are always git and github.com, you can only use one private key.

It is also easy to specify the private key. Edit ~ /. Ssh/config. Add a configuration similar to the following:

Host php-backend.github.quyun.net
IdentityFile ~ /. Ssh/github-php-backend
User git

Host aliyun-api-tools.github.quyun.net
IdentityFile ~ /. Ssh/github-aliyun-api-tools
User git

The configuration format is very simple. I will not explain it much.

This is not enough. You will find that the host here is no longer github.com.
I used my own host for each warehouse, and the CNAME of each host domain name was resolved to github.com, so that ssh can be used to distinguish different warehouses during connection.

To test:

# Ssh-T git@php-backend.github.quyun.net
Hi quyun/php-backend! You 've successfully authenticated, but GitHub does not provide shell access.

# Ssh-T git@aliyun-api-utils.github.quyun.net
Hi quyun/aliyun-api-tools! You 've successfully authenticated, but GitHub does not provide shell access.

You can see that ssh can use different private keys based on different hosts.

Finally, change the host in your git repository address to the new host, as shown in the following figure:

Git@github.com: quyun/aliyun-api-tools.git

Changed:

Git@aliyun-api-tools.github.quyun.net: quyun/aliyun-api-tools.git

This problem also occurs in windows. You can solve it in the same way!

Related Article

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.