无法从 SourceTree 克隆 github 上的私有仓库 [英] Can't clone private repo on github from SourceTree

查看:112
本文介绍了无法从 SourceTree 克隆 github 上的私有仓库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 现在打开sourceTree

  • 点击 sourceTree 偏好 &点击添加帐户

  • 选择如下屏幕截图所示的选项
  • 输入用户名作为您的 Github 帐户用户名和密码作为 从 Github 生成的令牌
  • 点击保存,现在您可能会看到您的所有存储库都可见并且也可以克隆
  • 希望能帮到你

    A similar issue is described here however, my symptoms are a little different and none of the steps there seemed to work. Nor does the suggestion here work.

    I'm attempting to use SourceTree to clone a private repo belonging to github organization of which I am a part. I have full permissions to view and commit to the repo, I can see it online when I log in, AND I can clone just fine with the command line and also via the github desktop application. It only fails in SourceTree.

    Further, it is not bad credentials or anything like that, because I can clone, commit and push to my other non-private repos on github using SourceTree with my github credentials.

    From the "Clone a Repository" dialog I enter the source URL, which looks something like this:

    https://github.com/MyOrgName/reponame.git
    

    I tab off of that field and it populates the destination path and name fields, but at the bottom of the dialog is a yellow exclamation point with this error:

    This is not a valid source path / URL
    

    If I click the error message, it brings up the "Details" dialog, which states the following (twice for some reason):

    remote: Repository not found.
    fatal: repository 'https://github.com/MyOrgName/reponame.git/' not found
    remote: Repository not found.
    fatal: repository 'https://github.com/MyOrgName/reponame.git/' not found
    

    I have also tried this by adding my username to the url like so:

    https://myusername@github.com/MyOrgName/reponame.git
    

    but no luck there either.

    解决方案

    It happens because SourceTree didn't get some private access from Github while authenticating. So the solution is very simple

    1. Login into your Github account on any browser
    2. From top right corner select SETTINGS
    3. Now select DEVELOPER SETTINGS
    4. From DEVELOPER SETTINGS select PERSONAL ACCESS TOKEN
    5. Now from PERSONAL ACCESS TOKEN select GENERATE TOKEN
    6. Fill Note as sourcetree and Check All Scopes from checkbox as show in below screenshots

    7. After Click on Generate Token

    8. Now Open sourceTree

    9. Click on sourceTree preference & Click add Account

    10. Select options as shown in below screen shot
    11. Enter username as your Github account username and password as Generated Token from Github
    12. Click on SAVE now you might see all your repository are visible and can clone too

    Hope it helps

    这篇关于无法从 SourceTree 克隆 github 上的私有仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆