I would need to add a second key to BitBucket for a second computer.
I read the relative documentation on section 'Set up additional SSH keys for Git' and understood Step 3, which seems pretty obvious: copy and paste your second key at BitBucket.
What I do not understand is Step 1, that is the necessity to change the 'git@bitbucket.org' part of the remotes into <username>@bitbucket.org
First of all my second computer is clean, does not have any cloned repository, thus I cannot do what Step 1 suggests.
Second, in my first computer all my remotes are like the ones below:
$ git remote -v
origin git@bitbucket.org:helfem/fireworks_app.git (fetch)
origin git@bitbucket.org:helfem/fireworks_app.git (push)
As you can see the <username> is 'helfem' and is already contained in the remote name, and the remote does its job, pushing and fetching the repository: why in my second computer would I be expected to change it into:
<username>@bitbucket.org:<username>/fireworks_app.git?
The username@bitbucket.org scheme is most useful if you're trying to use multiple accounts from the same computer - such as a work account and a personal account, or a contractor working with several different groups. You can still use git@ or hg@, though, and you can still use username@ even if you only have the one account.
However, it looks like you might be confusing the two usernames in a given remote - there's one that's used for authentication, and one that's used to indicate the repository owner. While those two usernames might be the same in some circumstances, it's better to think of the URL like this:
username@bitbucket.org:owner/repo.git
In that example, "username" is the person connecting, and "owner" is the person or team who owns that specific repo. (In the examples on the documentation you linked, "username" is the person connecting, and "teamsinspace" is the team that owns the repo.) The two usernames apply to HTTPS remotes as well, for the same reason.
@jredmondmany thanks for your help. I have only one account at BitBucket and I only fetch and push my own work to my own account so far.
I understand: I suppose that in my case "username" and "owner" be the same thing. I signed up at BitBucket with an email and a password and chose as username 'helfem'. So 'helfem' is my username. As 'helfem' I am also the owner of the repository, as indicated by the output of 'git remote -v':
$ git remote -v
origin git@bitbucket.org:helfem/fireworks_app.git (fetch)
origin git@bitbucket.org:helfem/fireworks_app.git (push)
Thus, as documentation and you suggest, if I am right, I could rename the remote as follow:
$ git remote set-url origin
helfem@bitbucket.org:helfem/fireworks_app.git
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.