このエラーは、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 fast-import : クラッシュ レポートを .git/fast_import_crash_5968 にダンプしています
では、このエラーの原因は何ですか?どうすれば解決できますか?
Git 高速インポートは、powershell スクリプトの出力を認識しません。これが、エラーを表示する itz の理由です: ブランチ名は git 標準に準拠していません: refs/heads/master. このスクリプトの出力を git fast-import にパイプして、git リモート リポジトリにあるそれぞれのファイルの履歴を表示しようとしていますが、上記のエラーが発生します (問題で述べたように)。私の powershell スクリプトは、以下回答。解決策を提供してください。
これは私のpowershellスクリプトです:
csv ファイルを走査するためのスクリプト
[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 リモート リポジトリに表示しようとしていますが、上記のエラーが発生します (問題で述べたように)。解決策を提供してください。