-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathquicktest
70 lines (33 loc) · 2.42 KB
/
quicktest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
http://stackoverflow.com/questions/959477/error-when-git-push-to-github
------------------------------------------------------
have public repository at github.com with 2 branches : "master" and "test".
I created new dir locally and did:
[ ] git clone [email protected]:{username}/{projectname}.git
Then i created new branch named "my_test" with
[ ] git branch my_test
and switched to it.
[ ] git checkout my_test
Then i merged it from my "test" branch of my public repository with
[ ] git merge origin/test
and it resulted in Fast forward.
I made some changes and committed it. Then i tried to push local "my_test" branch to public "test" branch at github with
[ ] git push [email protected]:{username}/{projectname}.git test
and get this error:
error: src refspec test does not match any.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '[email protected]:{username}/{projectname}.git
What i am doing wrong ?
---------------------------------------------------------------------
Perhaps try:
git push [email protected]:{username}/{projectname}.git HEAD:test
The format of the last parameter on that command line is a refspec which is a source ref followed by a colon and then the destination ref. You can also use your local branch name (my_test) instead of HEAD to be certain you're pushing the correct branch.
The documentation for git push has more detail on this parameter.
Perhaps try:
git push [email protected]:{username}/{projectname}.git HEAD:test
The format of the last parameter on that command line is a refspec which is a source ref followed by a colon and then the destination ref. You can also use your local branch name (my_test) instead of HEAD to be certain you're pushing the correct branch.
The documentation for git push has more detail on this parameter.
--------------------------------------------------------------------------
Also, you don't need to type out the whole url each time you want to push. When you ran the clone, git saved that URL as 'origin', that's why you can run something like 'merge origin/test' - it means the 'test' branch on your 'origin' server. So, the simplest way to push to your server in that case would be:
git push origin my_test:test
That will push your local 'my_test' branch to the 'test' branch on your 'origin' server. If you had named your local branch the same as the branch on the server, then the colon is not neccesary, you can simply do:
git push origin test