how to add remote repository using sourcetree

梦想的初衷 提交于 2019-12-10 16:38:33

问题


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.

I kinda rushed through the installation, so maybe that could be it.


回答1:


I'm assuming your local folder is initialized with git.

There are two ways you can achieve this:

Via Sourcetree app:

  1. In Sourcetree, check the left pane for Remotes

  1. Right click on it and select New Remote

  1. Insert the link to your repo and click on OK

  2. Once that's done, just do a Pull from your branch and commit your changes to the repo

Via Terminal (the easy way)

  1. cd /path/to/your/repo
  2. git remote add origin https://remote_url_of_your_repo
  3. git push -u origin master



回答2:


What Sahan said is correct. But what solved my issue was I had to create a folder first in the remote repository.



来源:https://stackoverflow.com/questions/45091933/how-to-add-remote-repository-using-sourcetree

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!