Choose the correct SSH key for authentication.Determine the repository's full name with owner, using a command such as git config -get.The function should perform the following steps. To use a different SSH key for different repositories that you clone to your workstation, you must write a shell wrapper function for Git operations. For more information about using SSH, see " Connecting to GitHub with SSH." If you want to use the SSH protocol for both accounts, you can use different SSH keys for each account. Git will cache the personal access token based on the full remote URL of the repository, and you'll be able to access and write repository data on using the correct account.Ĭontributing to multiple accounts using SSH and GIT_SSH_COMMAND Provide the personal access token for the account with access to the repository. The first time that you use Git to clone a repository or access data in a repository that you've already cloned, Git will request credentials. For more information, see " Managing your personal access tokens." Or, for each of your accounts and for each organization that you are a member of, create a fine-grained personal access token that can access the desired repositories and that has read and write permissions on repository contents. trueįor each of your accounts, create a dedicated personal access token (classic) with repo scope. For more information, see " Cloning a repository."įor more information about the use of SSH to access repositories on GitHub, see " Connecting to GitHub with SSH." Contributing to multiple accounts using HTTPS and personal access tokensĪlternatively, if you want to use the HTTPS protocol for both accounts, you can use different personal access tokens for each account by configuring Git to store different credentials for each repository. You can find both the HTTPS or an SSH URLs for cloning a repository on GitHub. With this approach to account management, you store the credentials for one account to use for HTTPS connections and upload an SSH key to the other account to use for SSH connections. The protocol you use to clone a repository determines which credentials your workstation will use to authenticate when you access the repository. Git can use either the HTTPS or SSH protocol to access and update data in repositories on. If you contribute with two accounts from one workstation, you can access repositories by using a different protocol and credentials for each account. Contributing to two accounts using HTTPS and SSH Other people can invite the account to contribute to both individual repositories and repositories owned by an organization, and the account can be a member of multiple organizations or enterprises. With a single personal account, you can contribute to a combination of personal, open source, or professional projects using one identity. If you aren't required to use a managed user account, GitHub recommends that you use one personal account for all your work on. Management of two or more accounts can increase the chance of mistakenly leaking internal code to the public. Warning: Be mindful when you use one workstation to contribute to two separate accounts.
0 Comments
Leave a Reply. |