6

I used to create an repo on my private git server

git init --bare
Initialized empty Git repository in /home/poc/git_repo/local_display_multi_langs .git/

Then I tried to add remote in my working copy on my mac.

git remote add origin ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git

Executed the following commands

 514 git flow init
 519 git flow feature start read_xml
 524 git ci -am "first ci"

Then tried to push all branches to my private git server's repo and got the exceptions as following

[src] $ git push origin feature
[email protected]'s password:
error: src refspec feature does not match any.
error: failed to push some refs to 'ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git'

Did I miss or misuse some steps ?

How to push all the branches on my working copy to remote server ?

Then When I clone the project from my git server.

How to get the new cloned project and original project are identical.

Thanks

Thanks for @VonC

Now I can push all the branches on my local working copy to remote server by

git push origin --all

But When I do git clone ssh://[email protected]/home/poc/git_repo/local_display_multi_langs.git under another folder.

[local_display_multi_langs] $ git branch -a
* master
 remotes/origin/HEAD -> origin/master
 remotes/origin/develop
 remotes/origin/feature/read_xml
 remotes/origin/master

I saw the above branches which are strange to me.

Because I expect get the same results as the original working copy like the following.

Is there any way to get clone from my remote server and restore the status as the original working copy

[local_display_multi_langs] $ git br
 develop
* feature/read_xml
 master
asked Dec 5, 2013 at 6:59

1 Answer 1

2

How could I push all the branched on my working copy to remote server ?

You can do at least a:

git push origin --all

'feature' is a command of git-flow, not the name of a branch.
See gitflow cheatsheet.

'feature' translate into a branch namespace, defining a branch hierarchy .
Pushing only those feature branches would be:

git push origin refs/heads/feature/*:refs/remotes/origin/feature/*

Or you can register the refspec in a .gitconfig.

answered Dec 5, 2013 at 7:11
Sign up to request clarification or add additional context in comments.

4 Comments

I thought feature is an default branch in git flow. Thanks for your answer
@poc no, feature is a branch namespace. You could push only feature branches with a refspec (git-scm.com/book/en/Git-Internals-The-Refspec) git push origin refs/heads/feature/*:refs/remotes/origin/feature/* (or specify that refspec in your .gitconfig: stackoverflow.com/a/1915046/6309)
Sorry I have no idea about the namespace in Git. I'll pick up the related knowledges. Thanks~ By the way, How could I get the 'same' working copy by git clone from my server
@poc a git clone will clone all remote branches: stackoverflow.com/a/72156/6309. (Unless you clone a clone: stackoverflow.com/q/5563349/6309). If you want those branches visible as your own local branches after a clone, you need to create them: stackoverflow.com/a/6300386/6309

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.