如何使用sourcetree+gitlab拉取项目代码 | 您所在的位置:网站首页 › 怎样从gitlab下载代码到本地 › 如何使用sourcetree+gitlab拉取项目代码 |
今天入职公司要求使用sourcetree+gitlab拉取项目代码,中途出现了很多问题,记下来与大家分享,(纯小白勿喷) 1下载相关文件首先下载sourcetree,官网下载地址:Sourcetree | Free Git GUI for Mac and Windows 下载git,官网下载地址:链接链接: Git - Downloads. 下载完git后新建文件夹右击出现git bush here时下载成功 下载完毕后会出现打不开sourcetree的问题 解决办法:在目录C:\Users\{youruser}\AppData\Local\Atlassian\SourceTree 下创建文件accounts.json ,注意:{youruser}需要替换为登录系统用户名。如我的电脑路径为: C:\Users\Admin\AppData\Local\Atlassian\SourceTree。写入如下内容: [ { "$id": "1", "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity", "Authenticate": true, "HostInstance": { "$id": "2", "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount", "Host": { "$id": "3", "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount", "Id": "atlassian account" }, "BaseUrl": "https://id.atlassian.com/" }, "Credentials": { "$id": "4", "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account", "Username": "[email protected]" }, "IsDefault": false } ] 2设置ssh,将ssh公钥私钥配置给sourcetree与gitlab生成ssh过程: 1.查看是否已经有了ssh密钥:cd ~/.ssh 如果没有密钥则不会有此文件夹,有则备份删除 2.生成密钥:(注意ssh与参数之间没有空格!!!) $ ssh-keygen -t rsa -C “邮箱地址”(注意是你的git邮箱) 按3个回车,密码为空。 此时我们回到C:\Users\admin可以发现有个.ssh文件夹,打开有两个文件 然后我们回到gitlab上
接着回到sourcetree点开工具——>选项 3拉取公司gitlab上的项目到本地 高级选项里有不同的版本,选择需要的版本即可 |
CopyRight 2018-2019 实验室设备网 版权所有 |