#1 I followed some articles on how to access github or bitbucket with two different ssh keys, and it works fine when I do a git clone ...
. So, I can do a git clone git://git@github.com/...
and git clone git://git@mycompany-bitbucket.org/...
without any problem.
#2 I also followed some article on how to use private repository
However, if I combine the two articles (#1 and #2), go get ...
will always use the https://api.bitbucket.org/2.0/repositories/...
. So, is there a way to force go get ...
to use something like https://api.mycompany-bitbucket.org/2.0/repositories/
?
Thank you all for your responses. After doing some testing and tinkering, I found out this definitive steps:
In ~/.ssh/config:
# Work Bitbucket account
Host work-bitbucket.org
HostName bitbucket.org
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_dsa-work
# Work Bitbucket account
Host altssh.work-bitbucket.org
HostName altssh.bitbucket.org
User git
AddKeysToAgent yes
IdentityFile ~/.ssh/id_dsa-work
The work-bitbucket.org
allows you to do 'git clone git@work-bitbucket.org/<account_name>/" and use a custom ssh key
The altssh.work-bitbucket.org
satisfies the requirement for go get ...
(with export GOPRIVATE=bitbucket.org/<account_name>
)
And also execute:
git config --global url."ssh://git@altssh.work-bitbucket.org:443/<account_name>".insteadOf "https://bitbucket.org/<account_name>"
Note about the 'work' prefix