Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Mac 中使用 Git
  7. 推送到远程存储库
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

推送到远程存储库

让我们推送到您在本教程的开头时创建的本地存储库。

打开 Sourcetree 并双击“tutorial”存储库。

Select tutorial repository

单击工具栏右侧的“Settings”按钮。

Click the setting button at the right side in the tool bar on the repository operation screen

单击“Add”。

Click Add button

输入以下内容:

  • 远程名称:origin
  • URL/路径:您之前在 Backlog 中创建的远程存储库的 URL
The URL of the remote repository you previously created in Backlog

单击“OK”。

Enter the URL of the remote repository and click OK button

远程存储库“origin”现在将显示在“remotes”列表中,我们可以开始将更改推送到 Backlog。

origin was added

如果您在控制台上,如果您在推送/拉取时省略了远程名称,在默认情况下将会使用“origin”远程存储库。这是因为惯例通常使用“origin”作为远程名称。

现在单击上方工具栏上的“Push”图标。

Click the push button at the tool bar on the tutorial repository operation screen

选择“main”复选框,并单击“OK”。

Click the OK button after check the check box of main

成功完成推送后,“origin/main”—代表远程提交—将显示在提交的“description”栏中。

The origin/main shown by the remote repository has been added

打开 Backlog 上的 Git 页面,您会发现在“Recent Updates”下面,列出了一个与您推送到远程存储库相对应的最新更新。

The push item is added to the recent updates.

推送的文件也会出现在远程存储库的文件列表中。

The file from the pushed repository is added.

接下来,我们将克隆这个远程存储库。

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life