步骤 2:创建 GitHub 存储库
您将需要 GitHub 存储库来存储修订。
如果您已拥有 GitHub 存储库,请确保在本教程中用其名称替换 CodeDeployGitHubDemo,然后向前跳至步骤 3:将示例应用程序上传到 GitHub 存储库。
-
在 GitHub 主页
上,执行下列操作之一: -
在 Your repositories 中,选择 New repository。
-
在导航栏上,选择 Create new(+),然后选择 New repository。
-
-
在 Create a new repository 页上,执行下列操作:
-
在存储库名称框中,输入
CodeDeployGitHubDemo。 -
选择 Public。
注意
选择默认的 Public(公有)选项意味着任何人均可查看此存储库。您可以选择 Private(私有)选项,限制可对存储库执行查看和提交的人员。
-
清除 Initialize this repository with a README(使用自述文件初始化此存储库)复选框。您将改为在下一步中手动创建
README.md文件。 -
选择创建存储库。
-
-
按照适用于您的本地计算机类型的说明操作以使用命令行创建存储库。
注意
如果您已在 GitHub 上启用双重验证,请确保输入您的个人访问令牌而不是您的 GitHub 登录密码(如果系统提示输入密码)。有关信息,请参阅提供您的双重身份验证代码
。
在本地 Linux、macOS 或 Unix 计算机上:
-
从终端中运行以下命令(一次运行一条命令),其中
user-name是您的 GitHub 用户名:mkdir /tmp/CodeDeployGitHubDemocd /tmp/CodeDeployGitHubDemotouch README.mdgit initgit add README.mdgit commit -m "My first commit"git remote add origin https://github.com/user-name/CodeDeployGitHubDemo.gitgit push -u origin master -
在
/tmp/CodeDeployGitHubDemo位置保持终端打开。
在本地 Windows 计算机上:
-
以管理员身份从命令提示符运行以下命令(一次运行一条命令):
mkdir c:\temp\CodeDeployGitHubDemocd c:\temp\CodeDeployGitHubDemonotepad README.md -
在记事本中,保存
README.md文件。关闭记事本。运行以下命令(一次运行一条命令),其中user-name是您的 GitHub 用户名:git initgit add README.mdgit commit -m "My first commit"git remote add origin https://github.com/user-name/CodeDeployGitHubDemo.gitgit push -u origin master -
在
c:\temp\CodeDeployGitHubDemo位置保持终端打开。