git VSTS:推送到远程存储库时遇到错误:不是有效的引用“来源/开发”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38732503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VSTS: Error encountered while pushing to the remote repository: Not a valid reference 'origin/development'
提问by mal-wan
Edit - This issue seems to have (at least temporarily) resolved itself - I have no idea why and I have not changed anything to make it work - I'll update if it breaks again
编辑 - 这个问题似乎已经(至少暂时)自己解决了 - 我不知道为什么,我没有改变任何东西来使它工作 - 如果它再次中断,我会更新
I used Git-TF (https://gittf.codeplex.com/) to move our existing Team Foundation Version Control repo to a new Git repo (both repos in the same VSTS Project).
我使用 Git-TF ( https://gittf.codeplex.com/) 将我们现有的 Team Foundation 版本控制存储库移动到一个新的 Git 存储库(两个存储库都在同一个 VSTS 项目中)。
It all appeared to work correctly. However now we have lots of issues.
这一切似乎都正常工作。但是现在我们有很多问题。
- Trying to push changes from a local branch to a remote branch gets the following error:
- 尝试将更改从本地分支推送到远程分支会出现以下错误:
Error encountered while pushing to the remote repository: Not a valid reference 'origin/development'
Error encountered while pushing to the remote repository: Not a valid reference 'origin/development'
- Using the Sync command, however, does work and pushes changes successfully to remote.
- Perhaps the biggest problem - we've only be able to get a Pull Request to work once. Now every Pull Request is throwing
405 error
for everything we try to do (abandon / accept - it all throws the same 405 Error)
- 但是,使用 Sync 命令确实有效并将更改成功推送到远程。
- 也许最大的问题 - 我们只能让一个 Pull Request 工作一次。现在每个拉取请求都在
405 error
为我们尝试做的所有事情抛出(放弃/接受 - 它都抛出相同的 405 错误)
Edit: Steps Taken to setup the Git repo
编辑:设置 Git 存储库所采取的步骤
- Downloaded and installed Git and Git-tf on my local machine
- Cloned the TFVC repo locally via git-tf
- Created a new Git Repo via VSTS
- Set the new repo as remote on my local machine
- Pushed the full history to the Git Repo
- 在我的本地机器上下载并安装 Git 和 Git-tf
- 通过 git-tf 在本地克隆 TFVC 存储库
- 通过 VSTS 创建了一个新的 Git Repo
- 在我的本地机器上将新仓库设置为远程
- 将完整的历史推送到 Git Repo
Steps taken once the Git repo was established
建立 Git 存储库后采取的步骤
- Created a development branch from the master
- Checked the development branch out locally via Vis Studio
- Created a new local branch from the local development branch
- Made changes and a few commits
- Publish the local branch to remotes
- Click on "Create a Pull Request" from Vis Studio
- Local Source Branch: test-branch, Remote target: development - then click Create
- No Merge Conflicts, I review my own work and Accept - so far so good
- Click on Complete Pull Request, leave "delete branch after merge" selected and click Complete Merge
- And this time it's worked...infuriatingly... The last 2 days it hasn't worked...
- 从 master 创建了一个开发分支
- 通过 Vis Studio 在本地检查开发分支
- 从本地开发分支创建了一个新的本地分支
- 进行了更改和一些提交
- 将本地分支发布到远程
- 从 Vis Studio 中单击“创建拉取请求”
- 本地源分支:测试分支,远程目标:开发 - 然后单击创建
- 没有合并冲突,我自己的工作并接受 - 到目前为止一切顺利
- 单击“完成合并请求”,选中“合并后删除分支”,然后单击“完成合并”
- 这一次它起作用了……令人气愤的是……过去两天它没有起作用……
Back to square one until I can repeat the process it seems.
回到第一个,直到我可以重复似乎的过程。
回答by user9371102
Try right-click on my local branch in Visual Studio under "Branches" in Team Explorer and do a Push, this is where it fails. If I go to "Sync" and do a Push under Outgoing Commits, it works fine.
尝试在团队资源管理器中“分支”下的 Visual Studio 中右键单击我的本地分支并执行推送,这是失败的地方。如果我转到“同步”并在传出提交下执行推送,它工作正常。
回答by Naz Kay
The same thing happened to me and I resolved it by going to my Repository Settings in Team Explorer > Settings and updating the settings under "Remotes". Origin was set incorrectly to a local git instance.
同样的事情发生在我身上,我通过转到“团队资源管理器”>“设置”中的“存储库设置”并更新“远程”下的设置来解决它。Origin 被错误地设置为本地 git 实例。