pushing git flow branches/model to remote server

3,328 views
Skip to first unread message

veverk...@gmail.com

unread,
Oct 8, 2013, 8:00:11 AM10/8/13
to gitflo...@googlegroups.com
I am trying to setup repository with gitflow support. I did following things:

On remote server:

root@czdc-repository tester]$ git init --bare
Initialized empty Git repository in /repo/git/INFRA_MGMT/tester/
[ SCREEN root@czdc-repository tester]$ ll
total 64
drwxrwx---+ 2 root root 4096 Oct  8 13:33 branches
-rw-rw----+ 1 root root   66 Oct  8 13:33 config
-rw-rw----+ 1 root root   73 Oct  8 13:33 description
-rw-rw----+ 1 root root   23 Oct  8 13:33 HEAD
drwxrwx---+ 2 root root 4096 Oct  8 13:33 hooks
drwxrwx---+ 2 root root 4096 Oct  8 13:33 info
drwxrwx---+ 4 root root 4096 Oct  8 13:33 objects
drwxrwx---+ 4 root root 4096 Oct  8 13:33 refs

###########################################################################
On localhost I've cloned repo and added readme file

(tester)veverka@czlx-veverka-mini [01:36:24] [~/git/tester] [master]
-> % git push 

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'repository.example.cz:/repo/git/INFRA_MGMT/tester'
(tester)veverka@czlx-veverka-mini [01:36:27] [~/git/tester] [master]
-> % git push origin master 

Counting objects: 3, done.
Writing objects: 100% (3/3), 233 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To repository.example.cz:/repo/git/INFRA_MGMT/tester
 * [new branch]      master -> master

==============================================================
Initialized git-flow

-> % git flow init -d
Using default branch names.

Which branch should be used for bringing forth production releases?
   - master
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [feature/] 
Release branches? [release/] 
Hotfix branches? [hotfix/] 
Support branches? [support/] 
Version tag prefix? [] 
(tester)veverka@czlx-veverka-mini [01:38:48] [~/git/tester] [develop]
-> % echo FLOW >> README 
(tester)veverka@czlx-veverka-mini [01:39:02] [~/git/tester] [develop *]
-> % git commit -a -m "edited README file"
[develop 4aefcd6] edited README file
 1 file changed, 1 insertion(+)

==============================================================
Added new feature

(tester)veverka@czlx-veverka-mini [01:39:18] [~/git/tester] [develop]
-> % git flow feature start testingGitFlow
Switched to a new branch 'feature/testingGitFlow'

Summary of actions:
- A new branch 'feature/testingGitFlow' was created, based on 'develop'
- You are now on branch 'feature/testingGitFlow'

Now, start committing on your feature. When done, use:

     git flow feature finish testingGitFlow

==============================================================
Published feature to remote server

(tester)veverka@czlx-veverka-mini [01:39:47] [~/git/tester] [feature/testingGitFlow]
-> % git flow feature publish testingGitFlow 
Counting objects: 5, done.
Writing objects: 100% (3/3), 265 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To repository.example.cz:/repo/git/INFRA_MGMT/tester
 * [new branch]      feature/testingGitFlow -> feature/testingGitFlow

Already on 'feature/testingGitFlow'

Summary of actions:
- A new remote branch 'feature/testingGitFlow' was created
- The local branch 'feature/testingGitFlow' was configured to track the remote branch
- You are now on branch 'feature/testingGitFlow'

==============================================================
After I've cloned repo from remote repository to another folder on localhost and can't see any gitflow branches

veverka@czlx-veverka-mini [01:43:18] [~/tmp] [develop]
-> % git clone repository.example.cz:/repo/git/INFRA_MGMT/tester
Cloning into 'tester'...

remote: Counting objects: 6, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (6/6), done.
veverka@czlx-veverka-mini [01:43:22] [~/tmp] [develop]
-> % cd tester 
veverka@czlx-veverka-mini [01:43:25] [~/tmp/tester] [master]
-> % ls
README
veverka@czlx-veverka-mini [01:43:26] [~/tmp/tester] [master]
-> % git branch
* master
veverka@czlx-veverka-mini [01:43:29] [~/tmp/tester] [master]
-> % git flow feature pull testingGitFlow
fatal: Not a gitflow-enabled repo yet. Please run "git flow init" first.



==============================================================
I've also tried to use git push --all  and git pull --all, but it didn't help
Local directory where gitflow was initialized:
(tester)veverka@czlx-veverka-mini [01:40:51] [~/git/tester] [feature/testingGitFlow]
-> % git push --all

Total 0 (delta 0), reused 0 (delta 0)
To repository.example.cz:/repo/git/INFRA_MGMT/tester
 * [new branch]      develop -> develop

Local cloned directory:
-> % git pull --all 
Fetching origin

From repository.example.cz:/repo/git/INFRA_MGMT/tester
 * [new branch]      develop    -> origin/develop
Already up-to-date.
veverka@czlx-veverka-mini [01:50:15] [~/tmp/tester] [master]
-> % git flow feature track testingGitFlow
fatal: Not a gitflow-enabled repo yet. Please run "git flow init" first.

==============================================================
Can anyone help what should I do to push gitflow to remote server so that if repo is cloned again, gitflow will bi initialized and ready to use?

Peter van der Does

unread,
Oct 8, 2013, 9:19:41 AM10/8/13
to gitflo...@googlegroups.com, veverk...@gmail.com
The git-flow configuration is not pushed to a remote repository, just like the hooks you created locally for example, are not pushed to the remote.

In order to use git-flow you always have to run git flow init after you cloned a git-flow enabled repository.


veverk...@gmail.com

unread,
Oct 8, 2013, 11:05:07 AM10/8/13
to gitflo...@googlegroups.com, veverk...@gmail.com
Hmm, good to know thanks, but I still can't see feature from cloned local repository. 
I've published feature testingGitFlow from original local repository: 

git flow feature publish testingGitFlow 

Branch 'origin/feature/testingGitFlow' already exists. Pick another name.

But can't see it from cloned repository: 

-> % git pull --all
Fetching origin

Already up-to-date.


-> % git flow feature list
No feature branches exist.

You can start a new feature branch:

    git flow feature start <name> [<base>]

Is this not the way the features should be published? 

Mateusz Loskot

unread,
Oct 8, 2013, 11:28:52 AM10/8/13
to gitflo...@googlegroups.com, veverk...@gmail.com
On 8 October 2013 16:05, <veverk...@gmail.com> wrote:
> Hmm, good to know thanks, but I still can't see feature from cloned local
> repository.
> I've published feature testingGitFlow from original local repository:
>
> git flow feature publish testingGitFlow
>
> Branch 'origin/feature/testingGitFlow' already exists. Pick another name.
>
> But can't see it from cloned repository:
>
> -> % git pull --all
> Fetching origin
>
> Already up-to-date.
>
>
> -> % git flow feature list
> No feature branches exist.
>
> You can start a new feature branch:
>
> git flow feature start <name> [<base>]
>
> Is this not the way the features should be published?

Read once again what Peter has written:

"you always have to run git flow init after you cloned a git-flow
enabled repository"


Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net

veverk...@gmail.com

unread,
Oct 8, 2013, 11:40:22 AM10/8/13
to gitflo...@googlegroups.com, veverk...@gmail.com
Ok, so hooks means no branches? 
Is there any way of sharing features among all users for current repository or it is obeying one developer = one feature rule? 

Mateusz Loskot

unread,
Oct 8, 2013, 11:44:31 AM10/8/13
to gitflo...@googlegroups.com, veverk...@gmail.com
On 8 October 2013 16:40, <veverk...@gmail.com> wrote:
> Ok, so hooks means no branches?

No, there is nothing related to hooks.

It means, that everyone who clones your repository will have to run
git flow init locally, to enable all git flow features for the clone.

> Is there any way of sharing features among all users for current repository
> or it is obeying one developer = one feature rule?

A feature is just a branch and once you clone/pull repo,
it is available as any other Git branch.

The only thing you need to do is to tell git-flow extension, locally,
to recognise those branches of you repo as git-flow branches.
Hence, git flow init after you clone.

veverk...@gmail.com

unread,
Oct 9, 2013, 3:09:14 AM10/9/13
to gitflo...@googlegroups.com, veverk...@gmail.com
Great I've got it working, thanks for your paitience and advices. 
My problem was that even when I've did publish feature using git flow feature publish <name> I didn't see it on second cloned repository. 
My bad was using git pull feature <name>. In this post: http://cetrasoft.com/blog/2012/03/05/git-flow-the-current-head-is-no-feature-branch.html I've found out that proper syntax for creating local branch is git flow feature origin <name>. 


Reply all
Reply to author
Forward
0 new messages