bash 从头开始一个 SourceTree git 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22275113/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Starting a SourceTree git project from scratch
提问by CodyBugstein
It's really unfortunate that there are no complete SourceTree tutorials out there.
很遗憾没有完整的 SourceTree 教程。
I'm trying to create a really simple git project to learn my way around git and SourceTree. So here's what I did:
我正在尝试创建一个非常简单的 git 项目来学习如何使用 git 和 SourceTree。所以这就是我所做的:
- I created a new folder and started an html page in it.
- In the
Git Bash
, I navigated to the directory and commandedgit init
- I created an account on BitBucket, I clicked "Create New Repository" and filled in the Name, Description, etc.
- I opened SourceTree with the goal of pushing this repository up to Bitbucket and then continuing to work on it (since I don't see any other way of starting up your project directly in BitBucket)
- 我创建了一个新文件夹并在其中启动了一个 html 页面。
- 在 中
Git Bash
,我导航到目录并命令git init
- 我在 BitBucket 上创建了一个帐户,单击“创建新存储库”并填写名称、描述等。
- 我打开 SourceTree 的目标是将此存储库推送到 Bitbucket,然后继续对其进行处理(因为我没有看到任何其他直接在 BitBucket 中启动项目的方法)
Can someone experience guide me as to what the next steps are to getting the repository set up on BitBucket using SourceTree?
有人可以指导我使用 SourceTree 在 BitBucket 上设置存储库的下一步是什么吗?
回答by Stephen Jennings
Use the "Clone / New" button and "Add a Working Tree". Choose the folder on disk where you ran git init
. This will get your repository into SourceTree.
使用“克隆/新建”按钮和“添加工作树”。选择您运行的磁盘上的文件夹git init
。这将使您的存储库进入 SourceTree。
To push to Bitbucket, you'll need to add your remote repository URL. While your repository is open in SourceTree, click the Settings button and add a remote. Choose to make this the defualt remote repository with the checkbox and put the URL of your repository in the URL field (for example, "https://bitbucket.org/your-name/your-repository").
要推送到 Bitbucket,您需要添加远程存储库 URL。当您的存储库在 SourceTree 中打开时,单击“设置”按钮并添加一个遥控器。使用复选框选择使其成为默认远程存储库,并将存储库的 URL 放在 URL 字段中(例如,“ https://bitbucket.org/your-name/your-repository”)。
You can also do this second step from the Git Bash using the command:
您还可以使用以下命令从 Git Bash 执行第二步:
git remote add origin https://bitbucket.org/your-name/your-repository
After this, you can commit and push your changes to Bitbucket.
在此之后,您可以提交更改并将更改推送到 Bitbucket。
If you wanted, you could also have created the repository directly in SourceTree by using the "Clone / New" button and choosing "Create a New Repository". This does the same thing as the git init
command and immediately puts the repository in SourceTree for you to use.
如果需要,您也可以通过使用“克隆/新建”按钮并选择“创建新存储库”直接在 SourceTree 中创建存储库。这与git init
命令执行相同的操作,并立即将存储库放在 SourceTree 中供您使用。