I'm looking for some code examples, for either [rugged](https://github.com/libgit2/rugged) or [grit](https://github.com/mojombo/grit), showing how to do a `git push`.

**Background**
--------------

I have rake tasks `deploy:staging` and `deploy:production` that I use to deploy my app.

I'm deploying to heroku, so these tasks essentially do the following:

1. Get the most recent tag (eg. `git describe --abbrev=0`)
2. Push the version represented by that tag to the specified remote (eg. `git push staging v1.00`)
3. Store the version in a heroku config var (eg. `heroku config:add APP_VERSION=v1.00`)

(There's also some checks in there to make sure I haven't forgotten to create a new tag before pushing etc.)

Initially I was using system calls from my Rakefile for these CLI commands; then I moved to using the [git](https://github.com/schacon/ruby-git) and [heroku-api](https://github.com/heroku/heroku.rb) gems.

The git gem appears to be abandoned however (no commits in the past year); it seems that Grit and rugged are now the standard gems for working with Git.

Unfortunately, given the lack of documentation, I can't figure out how to do a git push with either of these libraries.

(In the following examples, assume that the remote/branch I'm pushing to is origin/master, and is already setup as a remote in the local repo)

Starting with rugged:

```
$ irb
2.0.0-p0 :001 > require 'rugged'
 => true 
2.0.0-p0 :002 > repo = Rugged::Repository.new('/path/to/repo')
 => #<Rugged::Repository:0x007fe8b48821c0 @encoding=#<Encoding:UTF-8>> 
2.0.0-p0 :003 > remote = Rugged::Remote.lookup(repo, 'origin')
 NoMethodError: undefined method `lookup' for Rugged::Remote:Class

```

Now for grit:

```
$ irb
2.0.0-p0 :001 > require 'grit'
 => true 
2.0.0-p0 :002 > repo = Grit::Repo.new('/path/to/repo')
 => #<Grit::Repo "/path/to/repo/.git"> 
2.0.0-p0 :004 > remote = repo.remotes.last
 => #<Grit::Remote "origin/master"> 
2.0.0-p0 :005 > repo.git.push(remote)
NoMethodError: undefined method `delete' for #<Grit::Remote "origin/master">

```

Any help would be greatly appreciated.