Bitbucket git push commits without cloning the repo


I have a list of paths for configuration files that are stored in various Bitbucket repositories. I tried to download only those files for processing via an automated script.

I have successfully achieved that using a Python script that automates Bitbucket API 1.0 with OAuth, and I don’t have trouble retrieving the files nor processing them.

The actual problem

So now my problem is, now that I’ve processed the files, how do I commit the diffs (via automated script) and push them back up to the remote repositories? I don’t think Git typically supports single-file modifications.

Things I have considered:

  1. Cloning every single required repository, and using terminal calls to git commit, etc. to commit and push back up to the remotes. (Disadvantage: the repos are quite large and it would be cumbersome to clone them all.)

  2. Using git submodules. I am aware git submodules was suggested as a replacement for svn.externals, which would solve my problem fairly well. (Problem: I read the git submodules docs and couldn’t see how it would help in my situation).

  3. Simulating the POST calls to Bitbucket’s recently-implemented Online Editor (Problem: Bitbucket mentioned that it should only be used for testing purposes, and it is liable to change. Also hard to decipher the POST request)

  4. Using SSH for Git? (Don’t think that would help either.)

  • Merging Branches from Git
  • How to effectively organize scripts so they can be put under version control?
  • how check in code in two differents vcs
  • zsh vcs_info per repo configuration
  • Is there a single server I can use to store/manage version control for SVN/Git/Hg/etc?
  • Is it possible to turn off keyword substitution for 'svn export'?
  • What is stage status in Git?
  • How to make fork changes reflect with the master when updated?
  • One Solution collect form web for “Bitbucket git push commits without cloning the repo”

    Partial cloning or partial checkout isn’t supported in Git (as detailed in “Partial clone with Git and Mercurial”)

    considering that, since git 1.7.10, you can clone only one branch, would it be possible for you to manage those configuration file in a dedicated branch?

     git clone -b mybranch --single-branch /url/to/your/git/repo
    Git Baby is a git and github fan, let's start git clone.