简体   繁体   English

Bitbucket git push提交而不克隆存储库

[英]Bitbucket git push commits without cloning the repo

Background 背景

I have a list of paths for configuration files that are stored in various Bitbucket repositories. 我有存储在各个Bitbucket存储库中的配置文件的路径列表。 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. 我使用Python脚本成功实现了这一目标,该脚本使用OAuth自动实现Bitbucket API 1.0,并且检索文件或处理文件都没有问题。


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. 我认为Git通常不支持单文件修改。


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. 克隆每个必需的存储库,并使用终端调用git commit等进行提交并将其推回远程。 (Disadvantage: the repos are quite large and it would be cumbersome to clone them all.) (缺点:存储库很大,将它们全部克隆起来会很麻烦。)

  2. Using git submodules. 使用git子模块。 I am aware git submodules was suggested as a replacement for svn.externals, which would solve my problem fairly well. 我知道有人建议用git子模块代替svn.externals,这将很好地解决我的问题。 (Problem: I read the git submodules docs and couldn't see how it would help in my situation). (问题:我阅读了git子模块文档,但看不到它对我的情况有什么帮助)。

  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) 模拟对Bitbucket最近实现的在线编辑器的POST调用(问题:Bitbucket提到它仅应用于测试目的,并且易于更改,而且很难破译POST请求)

  4. Using SSH for Git? 使用SSH进行Git吗? (Don't think that would help either.) (也不认为这会有所帮助。)

Partial cloning or partial checkout isn't supported in Git (as detailed in " Partial clone with Git and Mercurial ") Git不支持部分克隆或部分检出 (如“ 使用Git和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 1.7.10起,您只能克隆一个分支 ,是否可以在专用分支中管理那些配置文件?

 git clone -b mybranch --single-branch /url/to/your/git/repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM