2017-11-25 4 views
0

.repoのマニフェストファイルに次の行があります。 manifest.xmlのgitコマンドで同じことを行うにはどうしたらいいですか? 特定のリビジョンと深さ= 1で 'git clone'を実行する方法を知りたいです。特定のリビジョンと深さでクローンを作成する方法= 1

<project clone-depth="1" groups="pdk-cw-fs,pdk-fs" name="repository name" path="repository path" revision="SHA1"/> 

答えて

2

revision特定のコミットまたは他のnamepaces下REFはなくrefs/tags/又はrefs/heads/場合revision分岐(refs/heads/xxx)またはタグ(refs/tags/xxx)、

git clone $remote -b $revision --depth=1 --single-branch 
#or 
git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD 

場合、

git fetch $remote $revision --depth=1 && git checkout FETCH_HEAD 

revisionがrefがポイントでない特定のコミットである場合error: Server does not allow request for unadvertised objectのためにgit fetchが失敗します。それは私のために動作しませんでした

uploadpack.allowTipSHA1InWant 
uploadpack.allowReachableSHA1InWant 
+0

git config内の変数やホスティングサービスの設定は非通知型のオブジェクトをフェッチすることができます。 サンプルリポジトリとしてhttps://github.com/hyde1004/test1.gitを使用しました。私が実行したとき 'git fetch https://github.com/hyde1004/test1.git 6e82b0b --depth = 1' を表示 "致命的なもの:gitリポジトリ(または親ディレクトリ)ではありません:.git " 。 そして、私は を実行すると、 'gitの初期化&& gitのhttps://github.com/hyde1004/test1.git 6e82b0b --depth = 1 ' それは'致命的な を表示フェッチ:リモートREF 6e82b0b' – user3381542

+0

が見つかりませんでしたが@ user3381542リモートリポジトリは、refなしで単一のコミットをフェッチすることを許可しません。 Gerritでホストされているプロジェクトはありますか? – ElpieKay

+0

最後に、Ubuntu 14.04でgitを1.9.1から2.15.0に更新した後、リポジトリを取得できました。 – user3381542

関連する問題