Rails routes have a priority based on a position in routes.rb file. Simple explanation of what is happening: some of your routes are more 'common' than others. So, for example:
match 'projects/:id/repository', :action => 'exec_client', :controller => 'repositories', :via => :post
match 'projects/:id/repository/:branch', :action => 'exec_client', :controller => 'repositories', :via => :post
Second route has no way to be triggered, because requests to /projects/:id/repository
will be routed to exec_client
action even if they have :branch
parameter (actually, any number of parameters). So, you need to follow this simple convention: more specific routes at the beginning of the file, more common routes at the end of the file.
Also, it's a bad practice to use identical routes (identical uri and HTTP verbs). According to route priorities, you will always trigger the highest variant (the one, who was defined earlier). The simplest thing you can do, is to make a separate route for each of your actions.
So, here's an example what should get you going:
match 'projects/:id/repository/publish', :action => 'exec_client', :controller => 'repositories', :via => :get
match 'projects/:id/repository/release', :action => 'exec_release', :controller => 'repositories', :via => :get
This will create a two separate routes for your actions. From what I've seen - :branch
parameter is optional. You can check for it's presence in the controller code. Also, I suggest you to read Rails Guide: Routing. This way, you learn about REST and Rails routing basics.