如何强制将代码从 Visual Studio 2019 推送到 GIt
How to force push code from Visual Studio 2019 to GIt
我创建了一个新的 Visual Studio 2019 项目。
尝试将其推送到 Azure Dev Ops 中的 Git 存储库时,出现以下错误
将分支推送到远程存储库时遇到错误:拒绝更新被拒绝,因为您当前分支的尖端落后于其远程分支。在再次推送之前集成远程更改。
无法将分支推送到远程存储库。有关详细信息,请参阅输出 window。
我该如何解决这个问题?有没有办法强制推送?
根据您的错误消息,远程分支在您克隆 Visual Studio 中的存储库后发生了一些变化。
要解决这个问题,您可以尝试以下两种方法:
在Visual studio中,当看到错误信息时,您可以在弹出窗口中看到Pull/Pull and Push
选项。
或在sync tab
2.Command 行脚本:由于您可以 运行 在 Visual stduio 中推送更改,因此 git 已经安装。
cd repo path
git pull
如果看不到,可以运行在cmd中执行以下命令:
更新1:
您可以 运行 在您的 repo 文件路径中执行以下 git 命令:
cd repo path
git pull
git add --all
git commit -m "first commit of my code"
git push -f origin master
当你 运行 拉 git 时,你可以检查它是否 returns 消息:Already up to date
.
如果是,您可以运行 git push 命令直接将更改推送到 Azure Repo。
我创建了一个新的 Visual Studio 2019 项目。
尝试将其推送到 Azure Dev Ops 中的 Git 存储库时,出现以下错误
将分支推送到远程存储库时遇到错误:拒绝更新被拒绝,因为您当前分支的尖端落后于其远程分支。在再次推送之前集成远程更改。 无法将分支推送到远程存储库。有关详细信息,请参阅输出 window。
我该如何解决这个问题?有没有办法强制推送?
根据您的错误消息,远程分支在您克隆 Visual Studio 中的存储库后发生了一些变化。
要解决这个问题,您可以尝试以下两种方法:
在Visual studio中,当看到错误信息时,您可以在弹出窗口中看到Pull/Pull and Push
选项。
或在sync tab
2.Command 行脚本:由于您可以 运行 在 Visual stduio 中推送更改,因此 git 已经安装。
cd repo path
git pull
如果看不到,可以运行在cmd中执行以下命令:
更新1:
您可以 运行 在您的 repo 文件路径中执行以下 git 命令:
cd repo path
git pull
git add --all
git commit -m "first commit of my code"
git push -f origin master
当你 运行 拉 git 时,你可以检查它是否 returns 消息:Already up to date
.
如果是,您可以运行 git push 命令直接将更改推送到 Azure Repo。