6

システム管理者がgerritリポジトリを設定するのを待っている間に、私は自分のブランチを作成しました。彼はちょうど今私にレポのアドレスを送ってくれました。私はそれをオリジンに設定し、どういうわけか私の最後のコミットをプッシュしました。リポジトリのクローン作成は正常に機能しますが、git branch -r何も返されません。ここで何が起こっているのですか?

$ git init
# made some comits    
git config remote.origin.url ssh://gerrit.mm-sol.com/branchname

$ git push origin SH1-of-my-last-commit:master    
error: unable to push to unqualified destination: master    
The destination refspec neither matches an existing ref on the remote nor  
begins with refs/, and we are unable to guess a prefix based on the source ref.  
error: failed to push some refs to 'ssh://gerrit.mm-sol.com/apps/phone-shaker'  

$ git push origin master
Counting objects: 85, done.  
Delta compression using up to 4 threads.  
Compressing objects: 100% (85/85), done.  
Writing objects: 100% (85/85), 20.95 KiB, done.  
Total 85 (delta 49), reused 0 (delta 0)  
remote: Resolving deltas: 100% (49/49)   
remote: Updating references: 100% (1/1)  
To ssh://gerrit.mm-sol.com/branchname  
 * [new branch]      master -> master  
4

2 に答える 2

23

これを試して:

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

してから再試行してくださいgit branch -r

将来、リモートを設定するときは、代わりに次のコマンドを使用することをお勧めしますgit config

git remote add <remotename> <remoteurl>

例えば

git remote add origin ssh://gerrit.mm-sol.com/branchname

urlこれにより、と構成の両方が自動的にセットアップされfetchます。

于 2012-09-25T09:03:02.693 に答える
1

してみてくださいgit push -u origin master

于 2012-09-25T08:08:41.550 に答える