如何通过termux应用将代码提交到Android上的GitHub

问题描述

如果有人可以通过termux终端在GitHub上删除用于创建存储库,提交代码并在GitHub上删除它们的termux命令的直接链接,我在众多Google搜索中所看到的只是如何安装它们,还不知道如何导航到某个文件或目录。

解决方法

首先,您必须在termux pkg install git中安装git。然后使用cd <name of your directory>

转到代码所在的目录

如果要创建git存储库,请使用git init

然后将文件添加到git git add <file name> 将所有文件添加到目录git add .

在安装git之后的第一次提交,您必须指定您是谁 git config --global user.name "<Your Name>" git config --global user.email "<your_email@whatever.com>"

然后使用 git commit -m "<commit message>"

提交消息是您在此提交中所做的更改

您必须在github github.com/new中创建一个存储库 并将github存储库URL添加到git git remote add origin https://github.com/<github username>/<github repository name>.git

然后将存储库推送到github。 git push -u origin master

-u表示将上游设置为默认值。之后git push

有一些有关git的教程参考 learnxinyminutesgithowto