I'm back with an old familiar problem. I'm working on a group project and our Bitbucket repository was created a few weeks ago. I tried to clone it and set the destination path to my Unity project folder, but I couldn't - it said I need to choose or create an empty folder. I've decided to create a new local repository in Sourcetree and add our Bitbucket repository as a remote repository. But, when I tried to push, the old "invalid username or password" error message appeared, even though I deleted the passwd file and removed any credential related to Bitbucket.
I know I could just clone our Bitbucket repository into an empty folder but then I'd had to move all my files from the Unity project folder into that folder and that would be exhausting. Any ideas on how to manage the situation?
Make sure your password is not stored in the Windows Credential Manager too. I would recommend that you use an SSH key instead, that way you do not have to worry about passwords. Your other option is to turn off Windows Credential Manager and see if that helps.
git config --system --unset credential.helper
git config --global --add core.askpass
""
The first command disables Credential Manager for Git, the second one turns it off for openSSH.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For anyone wondering: you will probably find your answer somewhere in the replies to the one I marked as "accepted".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is what I got. Here's what went down:
1. I created a new repository on Bitbucket. The "master" branch also got created in the process and it included the README.md file.
2. I then made a new repository on my computer using Sourcetree. I committed a few files and they were all in the "master" branch.
3. I added a remote repository in Sourcetree which was, of course, the one I created earlier on Bitbucket.
4. I tried to push to Bitbucket the files I just committed to the "master" branch in Sourcetree.
5. After that failed I pulled from Bitbucket (it was only the README.md file).
6. After multiple attempts, I couldn't push the files from Sourcetree to the Bitbucket repository into the "master" branch. But then I made a "new" branch and it worked but I wanted the files from Sourcetree to be in the "master" branch in Bitbucket. I tried to merge the two branches on Bitbucket but I couldn't because they're unrelated.
Apart from the error message screenshot, I'm also adding the screenshots from Sourcetree and Bitbucket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, so the first error message indicate that your username or password is incorrect, so you should make sure that the password stored in Sourcetree and Windows Credential manager is correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I made sure of that but even after that, I wasn't able to push the files which I committed to the "master" branch in Sourcetree to the "master" branch in Bitbucket. I didn't capture that error message though - I hope you might still be able to help me anyway considering my description of what went down.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are lots of things that can prevent you from pushing to a specific branch, for example branch permissions, hooks, etc. Do another push of master and see what error message you get.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's what I get. Even after I performed the action "pull" (a few days ago when this problem occurred and I had to "make a compromise" to finish my school work) I still couldn't get the files to be pushed into the "master" branch on Bitbucket. It was sort of untouchable, so to speak. And the only way to not get the invalid username/password error for me is to include username:password in the link to the repository on Bitbucket which isn't very private since I have to take screenshots for my school work. I was trying to sort things out in Sourcetree in Authentication bar in Tools>Options, but these credentials, or whatever you want to call them, confuse me, the whole process does.
All want to know (with simple and plain instructions, not like those tutorials where they just go on blabbing about this and that and so on) is how I can create a repository on Bitbucket, create a remote repository in Sourcetree so I can push to the repository on Bitbucket (to any branch I desire) and how to set the credentials right so that I don't have to deal with any errors.
Thank you in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think I know what got you into this issue in the first place, you created a new repository locally instead of cloning the remote repository. This would also explain why you could not merge your changes into master in Bitbucket.
Okay, so here is the simple guide you are looking for to create a repository and clone it:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Believe it or not, I've tried that before as well. But, a familiar error message appeared:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So try this, go to c:\users\<your user ID>AppData\local\atlassian\sourcetree and remove the passwd file. Then go to Credential Manager (under control panel) and remove any references to Bitbucket. If you now do another clone you should be asked to enter your Bitbucket password.
You could also try and setup a SSH key, that way you do not have to deal with usernames and passwords for Bitbucket. You can find the instructions on how to do that here: https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you! I know this was a lengthy back and forth discussion but I was able to clone the repository, commit files and push to Bitbucket with no problem. Thank you again :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are most welcome, glad it got solved!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Darn! Even tried restarting laptop and Sourcetree is still wanting to log in with username and password (after setting up SSH key successfully) and fails. Now what? Thanks,
Tien
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Vito Kurnik,
Welcome to the Atlassian Community.
Do you get an error message when you try and push? And if so, what is that error message?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, @Mikael Sandberg I have included the error message screenshot and some other details in my answer down below.
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.