2016-04-22 7 views
1

git-fetchドキュメントでは、あなたが見ることができます:致命的な:無効refspec '+レフリー/ヘッド/ *'

The remote ref that matches <src> is fetched, and if <dst> is not empty string, the local ref that matches it is fast-forwarded using <src>. If the optional plus + is used, the local ref is updated even if it does not result in a fast-forward update.

だから我々はempty string as destinationを使用することができます。現在私の現在のリポジトリにはリモコンがあり、その名前はoriginです。私はこのようなフェッチしようとすると、私はエラーを取得する:

git fetch origin +refs/heads/* 
fatal: Invalid refspec '+refs/heads/*' 

しかし、なぜempty string原因invalid refspec

答えて

1

時間の経過と共に進化し、現在のベストプラクティスのrefspecsはgitバージョン1.5のためにしか考案されていませんでした。

いずれにしても、シェルグロブスタイル*のマッチは制限されています(前のバージョンではless so in git 2.6)。 1つの制限は完全なペアを必要としています。つまり、対応する*がなくてもフェッチrefspecの左側にワイルドカードの一致*を使用することはできません。これは、の場合、コマンドラインで論理的に動作する必要があります(一致するrefをFETCH_HEADにドロップできるはずです)ので、gitは空のrefspecを拒否します。

1

When I try to fetch like this, I get an error:

この方法で情報を取得する必要はありません。

あなたがこの(REFその人自身を定義する必要はありません)のようにそれを使用することができます:gitのドキュメントのすべてでrefspec説明が一部にあるすべてこのため、一般的に少し悪い

# fetch all ref 
git fetch 

# fetch a specific ref 
git fetch origin 

The format of a parameter is an optional plus +, followed by the source ref , followed by a colon :, followed by the destination ref . The colon can be omitted when is empty.

+0

OK!しかし、私はエラーを引き起こす原因を見つけたい。 – hasanghaforian

+0

更新のリモートを取得中にブランチをフェッチしようとしました。 'refs/heads'は分岐であり、リモートではありません – CodeWizard

+0

しかし' $ git fetch origin + refs/heads/*:refs/remotes/origin/* 'をエラーなしで使うことができます。 – hasanghaforian