将powershell脚本的输出传递给git fast import时发生此错误。详细的错误报告如下:
D:\ demo_history7 [master + 4~0 -0!]> 。\ testscript.ps1 -CSVFileName Report_Recent.csv | git fast-import fatal:分支名称不符合 到GIT标准:refs / heads / master快速导入:转储崩溃报告 到.git / fast_import_crash_5968
那么这个错误的原因是什么,我该如何解决?
Git快速导入无法识别powershell脚本的输出。这就是为什么itz显示错误:分支名称不符合git标准:refs / heads / master。 我试图将此脚本的输出传递给git fast-import,以便在git远程存储库中显示相应文件的历史记录,但是得到上述错误(如上所述)。我的powershell脚本在低于答案。 请提供解决方案。
这是我的powershell脚本:
[CmdletBinding(SupportsShouldProcess=$true)]
Param
(
[string] $CSVFileName
)
# Readthe contents of the CSV file in a single shot
#Write-Output "CSV File Name is $CSVFileName"
$CSVFileContents = Import-Csv $CSVFileName
# Iterate through each file(column) in the list
foreach($CSVFile in $CSVFileContents)
{
# Get the parameters related to each file(column)
$FileVersion = $CSVFile."File Version"
$Owner = $CSVFile.Owner
$UpdateDate = $CSVFile."Update Date"
$FileName = $CSVFile.Filename
$Specification = $CSVFile.Specification
$ProjectFolder = $CSVFile."Project Folder"
#Get the string size of the path
$FolderName = "D:\demo_history\" + $ProjectFolder + $FileVersion + "_" + $FileName + "\" + $FileVersion + "_" + $FileName
$FolderName = $FolderName.Replace("/","\")
$count = $FolderName.length
#Get contents of the file,display the contents and get size
$Filecontent = Get-Content D:\demo_history2\RMS\APP\RSS\src\com\retek\stores\transfers\states\1_SearchTransferState.java\SearchTransferState.java
$Getitemsize = Get-Item D:\demo_history2\RMS\APP\RSS\src\com\retek\stores\transfers\states\1_SearchTransferState.java\SearchTransferState.java
$Length = $Getitemsize.length
$getmark=Write-Output "mark :$FileVersion"
$Comment = "from Serena Dimensions by $Owner on $UpdateDate"
$Sample = $ProjectFolder + $FileVersion + "_" + $FileName + "\" + $FileVersion + "_" + $FileName
$Sample = $Sample.Replace("/","\")
$Mode = "M 644 inline $Sample"
#printing output
Write-Output "commit refs/heads/master\r\n"
Write-Output "$getmark"
Write-Output "committer $Owner <$UpdateDate> -62167239000 -0700"
Write-Output "data $count"
Write-Output "$Comment"
Write-Output "$Mode"
Write-Output "data $Length"
Write-Output "$Filecontent"
}
我正在尝试将此脚本的输出传递给git fast-import,以便在git远程存储库中显示相应文件的历史记录,但是会出现上述错误(如上所述)。请提供解决方案。
答案 0 :(得分:0)
分支名称testscript.ps1
由git中分支名称的一些无效字符组成。
Git分支名称不能包含以下字符:
- Have a path component that begins with "."
- Have a double dot ".."
- Have an ASCII control character, "~", "^", ":" or SP, anywhere
- End with a "/"
- End with ".lock"
- Contain a "\" (backslash