【问题标题】:how commit and push all changes in bitbucket如何提交和推送 bitbucket 中的所有更改
【发布时间】:2017-11-25 15:18:06
【问题描述】:

我在远程创建了一个分支并在本地创建了一个分支(git checkout -b gopinath)

之后我按照以下步骤操作

0)git remote add upstream [您的 bitbucket 存储库 url 放在这里。

1) git 初始化

2) 混帐状态

3) git add .

4) git commit -m "初始提交"

发出第四条命令后,我遇到了这个问题

atal: The current branch gopinath has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin gopinath

为什么我会遇到这个问题,我正在以正确的方式将我的代码推送到 bitbucket。

如果我在本地结帐并删除分支,我会收到此错误消息

您的姓名和电子邮件地址是根据自动配置的 在您的用户名和主机名上。请检查它们是否准确。 您可以通过显式设置来抑制此消息: git config --global user.name "你的名字" git config --global user.email you@example.com 完成此操作后,您可以通过以下方式修复用于此提交的身份:

git commit --amend --reset-author

8个文件改变,6个插入(+),8个删除(-)`

更新

git branch -a 在这之后我得到了*master

git remote -v为此我得到
upstream https://gopinath123@bitbucket.org/mobinius/ionicpoc.git (fetch) upstream https://gopinath123@bitbucket.org/mobinius/ionicpoc.git (push)

git log --graph --all --decorate --oneline我明白了

* 5c12918 (HEAD -> master) keychain demo * 8b518a4 Initial commit

【问题讨论】:

  • 你在 git git remote add origin your_gitrepo_url 中添加了远程仓库 URL 吗?
  • 你需要添加远程仓库 git remote add origin(upstream) repo_url
  • 是的,我已经添加了一个@IvanSheigets
  • @ShahrozeNawaz 添加远程来源后我得到fatal: remote origin already exists.
  • 你没有显示你已经执行的所有命令,是吗?另一点:我认为您在推送命令后收到错误,对吗?

标签: git bitbucket


【解决方案1】:

除了一个叫做 master 的本地分支(默认)之外,你目前还没有一个叫做任何东西的本地分支。

所以先创建分支:

git branch gopinath

现在检查一下(移动到那个分支)

git checkout gopinath

如果需要,现在进行一些更改并添加它们:

touch newfile
git add newfile

现在您可以提交这些更改

git commit -m "added a file called newfile"

现在您可以将这些推送到您的遥控器(称为“上游”)

git push upstream gopinath

那应该能让你到达那里...... 可能值得删除您拥有的遥控器并重新创建它们,称为“origin”,因为这是原始仓库位置的一种标准名称......如果您需要这样做,请告诉我我会添加命令。

【讨论】:

  • 实际上我删除了我的分支,所以只有我没有显示它,但现在我尝试并创建了分支,我在提交命令后遇到了这个问题
  • Your name and email address were configured automatically basedon your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author
  • 没关系 - 它只是一个警告,但你可以按照它的建议来摆脱它。它是说它不知道你是谁,所以当它将你的详细信息添加到它使用你的用户名的提交时。所以从字面上运行命令git config --global user.name "Your Name" 和git config --global user.email you@example.com,你应该为将来的提交排序
  • 如果我结帐到 master 我收到此错误错误:src refspec gopinath does not match any。错误:未能将一些引用推送到“原点”
  • 你没有一个叫做“origin”的遥控器,你把它叫做“upstream”:o
猜你喜欢
  • 1970-01-01
  • 2019-10-28
  • 2013-02-13
  • 2013-01-01
  • 1970-01-01
  • 2021-08-22
  • 1970-01-01
  • 2021-03-15
  • 2018-07-09
相关资源
最近更新 更多