2016-08-18 8 views
1

私はgit cloneコマンドに問題があります。私は`git clone/DIRECTORY`と` git clone file:/// DIRECTORY`

$ git clone /SOURCE_DIRECTORY /TARGET_DIRECTORY 

を実行すると、すべてが正常に動作し、私は、このコマンド(のみfile://が追加)

$ git clone file:///SOURCE_DIRECTORY /TARGET_DIRECTORY 

を実行すると、私は

Initialized empty Git repository in /TARGET_DIRECTORY/.git/ 
remote: Counting objects: 737, done. 
remote: Compressing objects: 100% (189/189), done. 
remote: Total 737 (delta 264), reused 725 (delta 256) 
Receiving objects: 100% (737/737), 68.25 KiB, done. 
Resolving deltas: 100% (264/264), done. 
error: Trying to write ref HEAD with nonexistant object XXXXXXXX 
fatal: Cannot update the ref 'HEAD'. 
を取得

Initialized empty Git repository in /TARGET_DIRECTORY/.git/ 

を取得します210

誰でも教えてください。/DIRECTORYfile:///DIRECTORYの違いは何ですか?なぜ私はここで別の結果を得るのですか?

+0

特定のディレクトリ名またはディレクトリ名にありますか? –

+0

''/var/lib/jenkins/jobs/project/workspace'などのディレクトリで再現可能です。 –

+2

'' https:/ 'の ''ローカルプロトコル'/git-scm.com/book/en/v2/Git-on-the-The-Server-The-Protocols ' – ElpieKay

答えて

1

@ElpieKayはとコメントしていることGit Docsへのリンクから:だから、あなたが見る余分な出力は、Gitはデータを転送するために、そのネットワークスタックをスピンアップ、代わりに地元をやっているという事実を意味

Git operates slightly differently if you explicitly specify file:// at the beginning of the URL. If you just specify the path, Git tries to use hardlinks or directly copy the files it needs. If you specify file:// , Git fires up the processes that it normally uses to transfer data over a network which is generally a lot less efficient method of transferring the data. The main reason to specify the file:// prefix is if you want a clean copy of the repository with extraneous references or objects left out – generally after an import from another version-control system or something similar

最初の例のようにコピーします。したがって、ネットワークスタックを使用してデータを転送する理由がない場合は、file://を削除することをお勧めします。

エラーについて:

:これらの答えは、これはGitリポジトリの古いバージョンを使用することによって引き起こされる可能性があることを示す

error: Trying to write ref HEAD with nonexistant object XXXXXXXX 
fatal: Cannot update the ref 'HEAD'. 

Gitクライアントをアップグレードしてみてください。

+1

詳細な回答はThxにあります。私の問題は、 'file://'を "落とす"ことができないということです。なぜなら、この操作は簡単には影響を受けないMavenコマンドの内部で起こるからです。しかし今、私は次に何をすべきかを知っていて、新しいGitバージョンを試してみます。 –

+1

gitを更新すると、何故2日前にすべてがうまくいったのか、そして突然 "突然"働いていないのだろうかと疑問に思った。 –

+0

突然何が壊れてしまうのか分からない。あなたはそれを固定してうれしい! –

関連する問題