1

I'm attempting to make an initial push on a large project that I'm editing (I'm not the original author) and when I go to push the projectmy github repo it asks me for someone elses password on bitbucket???

I've tried creating a new account on github and reseting global username/ password, deleted all files related to git on keychain and tried changing the directory names.

project-name darrinwebster$ git push -u origin master

Password for 'otherPersonsBitbucketAccount.org':

remote: Invalid username or password

fatal: Authentication failed for 'otherPersonsBitbucketAccount.org'

I'm expecting git to ask for my credentials (for github) as I've set the repository origin to my account.

  • What's in the `[user]` block of your .gitconfig for that project? – jmargolisvt Dec 23 '18 at 04:01
  • user.name=Darrin Webster But i just noticed that the remote url is set to otherPersonsBitbucketAccount.org How would i go about changing that property specifically if possible? – Darrin Webster Dec 23 '18 at 04:52
  • 1
    @jmargolisvt: the `user.name` and `user.email` settings are used only for making commits, not for authentication. @DarrinWebster: authentication methods depend on both the URL (https vs ssh) and any OS-specific treatment for ssh or https authentication, plus any credential-caching you may have instructed Git to use. – torek Dec 23 '18 at 05:42
  • So are you saying its iompossible to change the origin URL? I'm sorry this is all really confusing me – Darrin Webster Dec 23 '18 at 06:22
  • 1
    What URL are you using? It is of course possible to *change* it; it's just a setting. – torek Dec 23 '18 at 09:33
  • Possible duplicate of [How to change the URI (URL) for a remote Git repository?](https://stackoverflow.com/questions/2432764/how-to-change-the-uri-url-for-a-remote-git-repository) – phd Dec 23 '18 at 13:00
  • https://stackoverflow.com/search?q=%5Bgit%5D+change+remote+URL – phd Dec 23 '18 at 13:00

2 Answers2

1

You probably want to reset the URL of your origin remote to point to your GitHub account instead of the other person's Bitbucket account. You can do this with something like the following:

git remote set-url origin https://github.com/example-user/example-repo.git

You could also use an SSH URL if you prefer that:

git remote set-url origin git@github.com:example-user/example-repo.git

If you want, you can just add a different remote, and then push to that remote instead:

git remote add github https://github.com/example-user/example-repo.git
git push -u github master

You can of course use any URL you control; if you wanted to use a Bitbucket account instead of a GitHub account, that would be fine.

bk2204
  • 64,793
  • 6
  • 84
  • 100
-3

Git takes the username from the git config So I would start with checking the username from git config (git config --global user.name). If its the issue you can change the username with git config --global user.name "John Doe"

  • "I've tried creating a new account on github and reseting global username/ password" is it possible to change the remote.origin.url block of config? – Darrin Webster Dec 23 '18 at 09:01
  • The repo is private? the second option (If you think the get config is right) you need to check your permission in github (gitlab? not sure what you are using)? – Limor Stotland Dec 23 '18 at 09:15
  • 3
    `user.name` and `user.email` have nothing with authentication. They're copied to commits to set commits authorship, that's all. – phd Dec 23 '18 at 12:59