Last active
March 27, 2020 03:59
-
-
Save eversionsystems/0733cf63cfc269533f67b854ff5b22e8 to your computer and use it in GitHub Desktop.
How to tell Git which SSH Key to use - WPEngine Scenario with multiple accounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Examples of using WP Engine to setup repositories. If both sites are on the same account you can use the same private key. | |
#Windows user file c:\users\user\.ssh\config | |
Host website1 | |
User git | |
Hostname git.wpengine.com | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/key_rsa | |
IdentitiesOnly yes | |
Host website2 | |
User git | |
Hostname git.wpengine.com | |
PreferredAuthentications publickey | |
IdentityFile ~/.ssh/key_rsa | |
IdentitiesOnly yes | |
#Config file in GIT directory of local install website 1. We use "prod" as the alias for the remote | |
#Typical format for a WPEngine remote URL is [email protected]:production/websiteremote.git | |
#We can replace [email protected] with your host name setup. | |
#Here is an example of .git\config file for website1 project folder | |
[core] | |
repositoryformatversion = 0 | |
filemode = false | |
bare = false | |
logallrefupdates = true | |
symlinks = false | |
ignorecase = true | |
[remote "prod"] | |
url = website1:production/xxxprod.git | |
fetch = +refs/heads/*:refs/remotes/prod/* | |
[remote "staging"] | |
url = website1:production/xxxstaging.git | |
fetch = +refs/heads/*:refs/remotes/staging/* |
@khoipro Yes each project folder has it's own .git/config, that's the basis of how git works. The trick is setting up the SSH config to define multiple websites to use the same git user but assign different hostnames.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So we need to add .git/config in each project folder @eversionsystems?