无法将文件夹推送到 Bitbucket 中的远程仓库

Failing to push to a folder to a remote repo in Bitbucket

我正在尝试将一些代码推送到 Bitbucket,这是我已经在本地计算机上克隆和初始化的远程存储库。但是,有两个文件,我试图将更改仅推送到一个名为 Ccode 的文件。我 cd 到本地目录 (Ccode) 并做了:

git add .
git commit -m 'Updates'
git push

但我得到:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to..
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.

所以,我试试 git pull 我需要另一个 window 来编写 git 合并消息。我不确定为什么但最终无法正常工作

hint: Waiting for your editor to close the file... error: There was a problem with the editor 'vi'.
Not committing merge; use 'git commit' to complete the merge.

我不知道合并的真正意义是什么,我正在尝试从第二个文件而不是 Ccode 文件中提取更改并仅推送到 Ccode 文件。 我真的有点困惑,不想给别人的回购造成问题。

I don't know what is the point of merge really and I am trying to pull changes from the second file not Ccode file and push only to the Ccode file.

git pull 从远程仓库获取内容并将其下载到本地仓库。有时这会导致冲突,例如您可能已经更改了本地仓库中的文件,这些文件在远程仓库中也已更改。 git merge 用于集成来自另一个分支的更改,即从远程仓库到本地仓库的分支。您可能还想阅读有关 merge conflicts.

的内容
hint: Waiting for your editor to close the file... error: There was a problem >with the editor 'vi'.
Not committing merge; use 'git commit' to complete the merge.

对于您遇到的关于提交编辑器的问题,似乎 git 似乎无法找到 vi 文本编辑器,如果您没有明确设置,它是后备选项您首选的编辑器。

来自文档:

core.editor

By default, Git uses whatever you’ve set as your default text editor via one of the shell environment variables VISUAL or EDITOR, or else falls back to the vi editor to create and edit your commit and tag messages.

如果您安装了 vi,请尝试使用完整路径,或者如果您想使用其他文本编辑器,您可以使用:

$ git config --global core.editor /path/to/editor