git 如何使用sourcetree添加远程存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45091933/
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
how to add remote repository using sourcetree
提问by Ezra Bekele
I'm using a Mac and I'm new to bitbucket and sourcetree. I want to push my local repository to a remote repository. So in sourcetree, I pressed "New", "clone from Url" and I pasted the url right from our remote repository. When I press enter, it says the url isn't valid.
我使用的是 Mac,我是 bitbucket 和 sourcetree 的新手。我想将我的本地存储库推送到远程存储库。因此,在 sourcetree 中,我按了“新建”、“从 Url 克隆”,然后直接从我们的远程存储库粘贴了 url。当我按回车键时,它说网址无效。
I kinda rushed through the installation, so maybe that could be it.
我有点匆忙完成安装,所以也许就是这样。
回答by Sahan Serasinghe
I'm assuming your local folder is initialized with git
.
我假设你的本地文件夹是用git
.
There are two ways you can achieve this:
有两种方法可以实现这一点:
Via Sourcetree app:
通过 Sourcetree 应用程序:
- In Sourcetree, check the left pane for
Remotes
- 在 Sourcetree 中,检查左窗格中的
Remotes
- Right click on it and select
New Remote
- 右键单击它并选择
New Remote
Insert the link to your repo and click on OK
Once that's done, just do a Pull from your branch and commit your changes to the repo
将链接插入到您的存储库中,然后单击“确定”
完成后,只需从您的分支执行 Pull 并将您的更改提交到 repo
Via Terminal (the easy way)
通过终端(简单的方法)
cd /path/to/your/repo
git remote add origin https://remote_url_of_your_repo
git push -u origin master
cd /path/to/your/repo
git remote add origin https://remote_url_of_your_repo
git push -u origin master
回答by Ezra Bekele
What Sahan said is correct. But what solved my issue was I had to create a folder firstin the remote repository.
萨汗说的是对的。但是解决我的问题的是我必须首先在远程存储库中创建一个文件夹。