git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

时间:2024-05-21 17:17:22

git bitbucket

For the purpose of this article, Bitbucket is chosen as a Git hosting service. In order to prepare the “communication” between Git hosting service and your application, the following steps need to be performed:

出于本文的目的, Bitbucket被选为Git托管服务。 为了准备Git托管服务和您的应用程序之间的“通信”,需要执行以下步骤:

  1. The first step is to create an account on Bitbucket if it’s not already created. The sign-up process is quite easy and it can be done by logging with Google account or creating a new account with e-mail and password:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    Learn more about creating a Bitbucket account from this link.

    第一步是在Bitbucket上创建一个帐户(如果尚未创建)。 注册过程非常简单,可以通过使用Google帐户登录或使用电子邮件和密码创建新帐户来完成:

    从此链接了解有关创建Bitbucket帐户的更多信息。

  2. Once the Bitbucket account is created, the next step is to create an empty repository.

    In the main bar, at the top of the page where the browser will lead after creating an account, click the Repositories, and choose the Create repository option:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    When a new page is opened, specify a Repository name, Access level and Repository type. Repository name and access level depend on the user’s preferences and, as already mentioned, Git will be chosen for the Repository type, but note that Bitbucket offers Mercurial as another repository type that can be created as well:

    Additionally, by expanding the Advanced settings, additional options such as description, forking, etc., can be set for the new repository:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    To learn more about Advanced settings, visit the following link.

    Once everything is set, click the Create repository button to finish the process.

    Also, if there is some code in an old repository, it can be used by clicking the Import repository in the top-right corner and the following window will be shown:

    To import the old repository, provide its URL address, username and password and enter the new repository name below it. Once this is all set up, click the Import repository button and old code will be added to the new repository.

    一旦创建了Bitbucket帐户,下一步就是创建一个空的存储库。

    在页面顶部的主栏中,浏览器将在创建帐户后进入浏览器的顶部,单击“ 存储库” ,然后选择“ 创建存储库”选项:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    打开新页面时,请指定存储库名称访问级别存储库类型 。 存储库名称和访问级别取决于用户的首选项,并且如上所述,将为存储库类型选择Git,但是请注意,Bitbucket还提供了Mercurial作为可以创建的另一种存储库类型:

    此外,通过展开“ 高级”设置 ,可以为新存储库设置其他选项,例如描述,分支等。

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    要了解有关高级设置的更多信息,请访问以下链接

    一切设置完成后,单击“ 创建存储库”按钮以完成该过程。

    另外,如果旧存储库中有一些代码,可以通过单击右上角的导入存储库来使用它,然后将显示以下窗口:

    要导入旧的存储库,请提供其URL地址,用户名和密码,然后在其下方输入新的存储库名称。 完成所有设置后,单击“导入存储库”按钮,旧代码将被添加到新存储库中。

  3. In the next step, browser will lead to the Repository setup page where an online repository path can be obtained.

    Expand the I’m starting from scratch and copy the marked path that will be used for the repository path when connecting your application:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    This is the Overview window after creating the new repository and from here navigation can be done to the Source, Commits, Branches, Pull requests, Downloads, and Settings tabs. All of these are accessible from the navigation tab on the left side:

    在下一步中,浏览器将转到“ 存储库设置”页面,可在其中获取在线存储库路径。

    展开我从头开始 复制连接应用程序时将用于存储库路径的标记路径:

    git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

    这是创建新存储库后的“ 概述”窗口,从此处可以导航到“ 源” ,“ 提交” ,“ 分支” ,“ 拉取请求” ,“ 下载 ”和“设置”选项卡。 所有这些都可以从左侧的导航选项卡访问:

For more information about getting started with Bitbucket cloud, visit the following link.

有关Bitbucket云入门的更多信息,请访问以下链接

在Git存储库上查看代码/提交的示例 (Examples for reviewing code/commits on Git repository)

Since the new repository won’t contain any commits/code, the following examples are created after a SQL database was committed to the Git repository, so that the mentioned tabs contain actual information that can be reviewed.

由于新的存储库将不包含任何提交/代码,因此在将SQL数据库提交到Git存储库后会创建以下示例,因此上述选项卡包含可以查看的实际信息。

In the Source tab, all folders under the repository root will be shown. Each folder can be considered as a different project and by changing the branch, different projects will be shown (if available):

在“ 源”选项卡中,将显示存储库根目录下的所有文件夹。 每个文件夹都可以视为一个不同的项目,并且通过更改分支,将显示不同的项目(如果有):

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

If one of the projects is clicked (in this example MyProject), it will open a list of folders, named by the SQL database objects which were previously committed:

如果单击其中一个项目(在本例中为MyProject) ,它将打开一个文件夹列表,该文件夹列表由先前提交SQL数据库对象命名:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

For example, click the Procedures folder and all committed procedures will be shown in the list:

例如,单击“ 过程”文件夹,所有已提交的过程将显示在列表中:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

Each of these procedures can be downloaded and edited locally or edited online.

每个过程都可以在本地下载和编辑,也可以在线编辑。

In the Commits tab, each commit can be reviewed by clicking the commit code in the Commit column marked below:

在“ 提交”选项卡中,可以通过单击以下标记的“ 提交”列中的提交代码来查看每个提交:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

When the commit code is clicked, all committed SQL object scripts will be shown and each one of them can be clicked to be reviewed or edited:

单击提交代码后,将显示所有已提交SQL对象脚本,并且可以单击其中的每个脚本进行查看或编辑:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

Learn more about commits and pushing changes from here.

此处了解有关提交和推动更改的更多信息。

As mentioned in the Source tab, branching the repository is available on Bitbucket and it can be used when testing certain procedure or function, for example.

如“ 源”选项卡中所述, 分支存储库在Bitbucket上可用,例如,在测试某些过程或功能时可以使用它。

When the Branches tab is clicked, the following window will show the main (master) branch and all other branches:

单击“分支”选项卡时,以下窗口将显示主(主)分支和所有其他分支:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

If any of branches is clicked, the new window will show all made commits (as in the Commits tab) and each commit can be also reviewed or edited:

如果单击任何分支,则新窗口将显示所有已提交的提交(如“提交”选项卡中所示),每个提交也可以进行查看或编辑:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

Read more about branching a repository from here.

此处阅读有关分支存储库的更多信息。

Q: Can I commit objects to a non-empty repository/project?

问:我可以将对象提交到非空的存储库/项目吗?

A: Yes. Objects can be committed to a non-empty repository/project, but if those objects have the same name as the ones in the repository, it can cause overwriting of repository objects.

答:是的。 可以将对象提交到非空的存储库/项目,但是如果这些对象与存储库中的对象具有相同的名称,则可能导致覆盖存储库对象。

Q: Is there a limit on the number of projects that can be created under the same source control repository?

问:在同一源代码控制存储库下可以创建的项目数量是否受到限制?

A: The limit for the number of projects depends on their size because Bitbucket repository is limited to 1 GB. That means you can create as many projects as you want, but their combined size cannot exceed 1 GB.

答:项目数量的限制取决于其大小,因为Bitbucket存储库限制为1 GB。 这意味着您可以创建任意数量的项目,但是它们的总大小不能超过1 GB。

Q: How can I check my current repository size?

问:如何检查当前存储库大小?

A: You can check your repository size by clicking the Settings tab on the left side pane and find the current repository size under a repository name:

答:您可以通过单击左侧窗格上的“设置”选项卡来检查存储库大小,并在存储库名称下找到当前存储库大小:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

Q: Which version of Git does Bitbucket support?

问:Bitbucket支持哪个版本的Git?

A: You can find out the information about the latest supported version anytime by scrolling down on any page of the Bitbucket site and click the Version info in the footer:

答:您可以随时向下滚动Bitbucket站点的任何页面,然后单击页脚中的“版本信息”,以找到有关最新支持版本的信息:

git bitbucket_如何在Bitbucket上创建新的Git存储库并查看提交的对象

Q: Are my repositories backed up by Bitbucket?

问:我的存储库是否由Bitbucket备份?

A: Yes, Bitbucket creates daily snapshot of your data and those snapshots are saved for seven days. Learn more about repository backups from this link.

答:是的,Bitbucket会创建您的数据的每日快照,并将这些快照保存7天。 从此链接了解有关存储库备份的更多信息。

翻译自: https://www.sqlshack.com/create-new-git-repository-bitbucket-review-committed-objects/

git bitbucket