I'm in a team of three; two are working locally, and I am working on the server.
My coworker set up the account, but gave me full privileges to the repository.
I set my username and email in git:
git config --global user.name "bozdoz"
git config --global user.email email@email.com
and they are identical to my username and email on bitbucket.org.
But when I pull or push to the repository it indicates their username in the prompt:
Password for 'https://theirusername@bitbucket.org':
I was able to get a prompt for my password after trying to pull by indicating the URL with my username:
git pull https://bozdoz@bitbucket.org/path/repo.git
and it said up-to-date; and then when I pushed, it said no-fast-forward.
I read that I need to specify the branch, but I don't know how to do that in a push statement while I'm also specifying the repo URL:
git push https://bozdoz@bitbucket.org/path/repo.git
I am able to pull and push if my co-worker is around and can put his password in. But this is also listing him as the author of the push, and not me.
How can I pull and push to a repo branch as my own username?
For myself private repo, i use
replace
I figured I should share my solution, since I wasn't able to find it anywhere, and only figured it out through trial and error.
I indeed was able to transfer ownership of the repository to a team on BitBucket.
Don't add the remote URL that BitBuckets suggests:
Instead, add the remote URL without your username:
This way, when you go to pull from or push to a repo, it prompts you for your username, then for your password: everyone on the team has access to it under their own credentials. This approach only works with teams on BitBucket, even though you can manage user permissions on single-owner repos.
The prompt:
suggests, that you are using https not ssh. SSH urls start with git@, for example:
Even if you work alone, with a single repo that you own, the operation:
will cause:
if the remote origin starts with
https
.Check your remote with:
The remote depends on
git clone
. If you want to use ssh clone the repo using its ssh url, for example:I suggest you to start with
git push
andgit pull
for your private repo.If that works, you have two joices suggested by Lazy Badger:
Run
and check whether your origin's URL has your co-worker's username hardcoded in there. If so, substitute it with your own:
Are you sure you aren't pushing over SSH? Maybe check the email associated with your SSH key in bitbucket if you have one.
Well, it's part of BitBucket philosophy and workflow:
i.e you can't (in usual case) commit into foreign repo under own credentials.
You have two possible solutions: