在git和bitbucket中使用自己的用户名/密码 [英] Use own username/password with git and bitbucket

查看:2648
本文介绍了在git和bitbucket中使用自己的用户名/密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个队伍两个在本地工作,而我正在服务器上工作。



我的同事设立了这个帐户,但给了我完整的权限。



我设置了我的用户名并在git中发送邮件:

  git config --global user.namebozdoz
git config --global user .email email@email.com

它们与我在bitbucket.org上的用户名和电子邮件完全相同。



但是当我拉到或推送到存储库时,它会在提示符中指明他们的用户名:

 'https://theirusername@bitbucket.org'的密码:

我在试图通过用我的用户名指明URL的情况下能够得到密码的提示:

  git pull https:/ /bozdoz@bitbucket.org/path/repo.git 

它表示最新;然后当我推时,它说不快进。

我读到需要指定分支,但我不知道如何在push语句中执行此操作,同时还指定了repo URL:

  git push https://bozdoz@bitbucket.org/path/repo.git 

如果我的同事在身边并且可以输入他的密码,我可以拉和推。但是,这也列出他作为

如何以我自己的用户名推送并推送到回购分支?

解决方案

运行

  git remote -v 

,然后检查您的原始网址是否包含您的同事用户名。如果是这样,用你自己的替代它:

  git远程设置网址来源< url-with-your-username> 


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?

解决方案

Run

git remote -v

and check whether your origin's URL has your co-worker's username hardcoded in there. If so, substitute it with your own:

git remote set-url origin <url-with-your-username>

这篇关于在git和bitbucket中使用自己的用户名/密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆