Skip to content

Instantly share code, notes, and snippets.

@SamyPesse
Last active December 20, 2015 08:19
Show Gist options
  • Save SamyPesse/6099875 to your computer and use it in GitHub Desktop.
Save SamyPesse/6099875 to your computer and use it in GitHub Desktop.
from gittle import Gittle
path = '/tmp/gittle_bare'
# Clone repository
repo = Gittle.clone('git://github.com/FriendCode/gittle.git', path)
# Information
print "Branches :"
print repo.branches
print "Commits :"
print repo.commit_count
# Create a new file
fn = 'test.txt'
filename = os.path.join(path, fn)
fd = open(filename, 'w+')
fd.write('My file commited using Gittle')
fd.close()
# Stage file
repo.stage(fn)
# Do commit
repo.commit(name='Samy Pessé', email='samypesse@gmail.com', message="This is a commit")
# Commit info
print "Commit : ", repo.commit_info()
# Auth for pushing
repo.auth(pkey=open("private_key"))
# Push
repo.push()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment