Thursday, April 24, 2014

error: src refspec staging does not match any.

I have two repository, one is development the other is staging. After finish the development, I will push to staging remote repo. I try to push to it and got:
 
git push interview staging  
error: src refspec staging does not match  
error: failed to push some refs to 'git@github.com:chienyuan/interview.git' any.  
It turn out I delete local staging branch. After I add the staging branch back the problem solved.
I still don't know what is the issue here. Let me study a little bits of git reference.
After an hour study, I kind of understand a little big about this refspec things. Here is good linkGit-Internals-The-Refspec.
So now I could just add push rule to .git/config
 [remote "interview"]  
   url = git@github.com:/chienyuan/interview.git  
   fetch = +refs/heads/*:refs/remotes/interview/*  
   push = refs/heads/master:refs/heads/staging  
Then I could just issue.
git push interview
Lesson Learn: Understand the internal is better way for learning git.

No comments: