为什么我无法将我的代码推送到 BitBucket?
Why I am not able to push my code to BitBucket?
我正在开发 flutter
应用程序并尝试将我的代码发送到 bitbucket
。我做了以下步骤。
- 转到
bitbucket
并创建一个新项目,在该项目下创建一个新存储库。
- 复制 repo url,类似于
https://abcd@bitbucket.org/abcd/my_project.git
- 使用终端,导航到我的 flutter 应用程序文件夹。
- 类型
git init
- 类型
git remote add origin https://abcd@bitbucket.org/abcd/my_project.git
- 类型
git add *
- 类型
git commit -m "first commit"
- 类型
git pull origin master
- 类型
git add *
- 键入
git commit -m "second commit"
(实际上这里没有什么可提交的,我只是做了)
- 类型
git push origin master
现在我得到以下错误
To https://bitbucket.org/abcd/my_project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org/abcd/my_project.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 pull origin master
!
你应该依靠一个不太复杂的过程来做同样的事情。
请尝试:
git clone https://abcd@bitbucket.org/abcd/my_project.git
cd my_project
cp -rv <MY_SOURCES_PATH>/* .
git add --all
git commit -m "A comment"
git push
如果有效请告诉我。
此致。
问题是有一个未同步的文件 .gitignore
。这不是默认提交的。所以我不得不
git add .gitignore
和
git commit -m "message"
我正在开发 flutter
应用程序并尝试将我的代码发送到 bitbucket
。我做了以下步骤。
- 转到
bitbucket
并创建一个新项目,在该项目下创建一个新存储库。 - 复制 repo url,类似于
https://abcd@bitbucket.org/abcd/my_project.git
- 使用终端,导航到我的 flutter 应用程序文件夹。
- 类型
git init
- 类型
git remote add origin https://abcd@bitbucket.org/abcd/my_project.git
- 类型
git add *
- 类型
git commit -m "first commit"
- 类型
git pull origin master
- 类型
git add *
- 键入
git commit -m "second commit"
(实际上这里没有什么可提交的,我只是做了) - 类型
git push origin master
现在我得到以下错误
To https://bitbucket.org/abcd/my_project.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org/abcd/my_project.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 pull origin master
!
你应该依靠一个不太复杂的过程来做同样的事情。
请尝试:
git clone https://abcd@bitbucket.org/abcd/my_project.git
cd my_project
cp -rv <MY_SOURCES_PATH>/* .
git add --all
git commit -m "A comment"
git push
如果有效请告诉我。
此致。
问题是有一个未同步的文件 .gitignore
。这不是默认提交的。所以我不得不
git add .gitignore
和
git commit -m "message"