Reputation: 17668
Sometimes ago I got this issue and tried to follow the instruction for my PC.
Cannot push to git repository on bitbucket
It worked, and I already have one SSH key with bitbucket.
Now I have another machine with a new hard drive, so I need to setup git again. I thought I could just add the global config:
git config --global user.name '<myname>'
git config --global user.email '<myemail>'
But it doesn't work. So it seems like I need to go through the steps mentioned in the above link all over again.
Is there a better way to setup that SSH access from an existing account (jsut from a differ machine) rather than following such a long and mundane steps.
Upvotes: 0
Views: 125
Reputation: 136910
Now I have another machine with a new hard drive, so I need to setup git again. I thought I could just add the global config:
git config --global user.name '<myname>' git config --global user.email '<myemail>'
But it doesn't work.
That's right. It would be a shame if somebody else could just run those commands and gain access to your account!
Those settings are actually irrelevant to Git authentication. They just determine how commits are recorded.
So it seems like I need to go through the steps mentioned in the above link all over again.
That's what I'd recommend: Generate a keypair for your new machine and add it to your Bitbucket account.
(Technically you could avoid creating a new keypair if you copy your existing keypair from your old machine onto your new one, but that's trickier than it sounds. OpenSSH is very picky about file permissions. I always create new keypairs per machine.)
Finally, you could access your repositories via HTTPS instead of SSH. That way you'd have to enter your Bitbucket user name and password to gain access. Though if you've enabled two-factor authentication that gets trickier…
Upvotes: 2