【发布时间】:2018-12-06 23:41:42
【问题描述】:
我面临一个奇怪的问题,文件同步到我的远程仓库(TFS 2015 Git 到 VSTS GIT)。
我的报告 1 是“sample.txt”,其中包含“Hello”。 我在 cmd 中使用这些命令:
git clone
git remote add vsts PAT
git checkout master
git push vsts master
当我将文件从 Hello 修改为 Hello 1 时,它没有问题 - > 执行相同的 CMD,我可以在远程仓库中看到我的所有更改。
现在,我在调用的 powershell 中有相同的 CMD
if ( $(git remote) -contains 'vsts' )
{
git remote rm vsts 2>&1|Write-Host
echo 'VSTS Account removed'
}
git remote add vsts https://Personal%20Access%20Token:TOKEN@my.visualstudio.com/teamproject/_git/repo 2>&1|Write-Host
git checkout ${env:BUILD_SOURCEBRANCHNAME} 2>&1|Write-Host
git push vsts ${env:BUILD_SOURCEBRANCHNAME} -f 2>&1|Write-Host
构建成功,但它不会同步我的更改。
我经常看到错误:
Previous HEAD position was eb5c087... Updated test.ps1
Your branch is behind 'origin/master' by 9 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Switched to branch 'master'
有时,相同的 CMD 来自 cmd 而不是 Powershell。
这方面有什么帮助吗?
【问题讨论】:
-
答案是否帮助您解决了问题?如果是,你能标记答案吗?它也将使遇到类似问题的其他人受益。
标签: git powershell cmd azure-devops