How can I automatically upload files to GitHub?

3 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2017 年 9 月 20 日
回答済み: MathWorks Support Team 2017 年 10 月 26 日
My MATLAB program is producing files. How can I automatically upload these files to GitHub?

採用された回答

MathWorks Support Team
MathWorks Support Team 2017 年 9 月 20 日
One potential way to automatically upload files to GitHub is to include "git" commands within the scripts generating the output files to automate the process of committing and pushing these files to your git repository.
To do so, the script would need to run within a directory which has been set up to use Git source control and linked to the desired GitHub repository. If this has not already been done, it can be accomplished by right-clicking in the "Current Folder" browser and selecting "Source Control > Manage Files..." and then following the prompts.
Then, in the desired script, you will add the "git" commands needed to upload the generated files. As MATLAB does not have built-in "git" commands, you will need to use the "!" symbol to instruct MATLAB to run them as operating system commands. For example, if you generate the file "file1.m" and want to upload it to the GitHub repository, you could add the following commands:
 
!git add file1.m
!git commit -m "added file1.m"
!git push
More information about using the "!" symbol can be found in the documentation page linked below:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSource Control についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by