gpt4 book ai didi

git - Bitbucket 文档在撒谎

转载 作者:太空狗 更新时间:2023-10-29 14:26:56 24 4
gpt4 key购买 nike

在Bitbucket官方网站上我们可以看到:

Locally, change to the root directory of your existing source.
Initialize the project by running the following commands in the terminal:

git init
git add --all git commit -m "Initial Commit"
Log into Bitbucket Server and create a new repository.
Locate the clone URL in the nav panel on the left (for example: https://username@your.bitbucket.domain:7999 /yourproject/repo.git).
Push your files to the repository by running the following commands in the terminal (change the URL accordingly):

git remote add origin https://username@your.bitbucket.domain:7999/yourproject/repo.git
git push -u origin master Done! Your repository is now available in Bitbucket Server.

来源:https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html

在这个命令之后我得到了:

To https://bitbucket.org/myrepo/myapp.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://myrepo@bitbucket.org/myrepo/myapp.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

所以现在我尝试获取

git fetch origin

再一次git push -u origin master

我得到了

> To https://bitbucket.org/myrepo/myapp.git 
> ! [rejected] master -> master (non-fast-forward) error: failed
> to push some refs to 'https://myrepo@bitbucket.org/myrepo/myapp.git'
> hint: Updates were rejected because the tip of your current branch is
> behind hint: its remote counterpart. Integrate the remote changes
> (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note
> about fast-forwards' in 'git push --help' for details.

有人可以帮助我吗?我为这个 git 浪费了太多时间

最佳答案

您收到的错误消息是因为存储库中已有提交。如果您使用的是 bitbucket.org(云 bitbucket)而不是 Bitbucket 服务器,它会为您创建自述文件。这会在存储库中提交一个提交,这将阻止您引用的步骤起作用。如果执行这些步骤时 repo 为空,则这些步骤有效

关于git - Bitbucket 文档在撒谎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52517940/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com