OSChina开源中国社区类似于github,具体区别参考百度。
1. 先下载SourceTree在MacBook上,然后在开源中国注册账号。在码云页面点击右上角头像下列‘修改资料’进到个人页面->SSH公钥->怎样生成公钥。
#&(此处的SourceTree版本稍低,做版本检查更新即可,若在官网下载,需先翻墙,因为注册需要Google验证码。翻墙参考文章)

2. 来到了 生成并部署SSH key 页面
3. 接着打开终端,按提示输入命令。
1> ssh-keygen -t rsa -C"此处输入邮箱地址"
(看命令回车两次输入Y再回车,输入密码两次)
2> cat ~/.ssh/id_rsa.pub
(得到下图,复制命令行下面的内容(公钥),点击SSH key添加地址)
3> 公钥标题随便写,把复制内容粘贴在下框,点确定生成公钥,再回到终端。

4> ssh -Tgit@git.oschina.net 测试公钥
(->提示输入yes回车,若返回 WelcometoGit@OSC, yourname! 表明添加成功<-)
4. 新创建一个项目,按提示填好资料。

5. 点击项目->克隆/下载->SSH->复制

6. 打开SourceTree->点击 +新仓库->从URL克隆->如下图操作

7. 添加.gitignore文件至项目中
1> 打开.gitignore下载地址->下载->USE HTTPS->确认下框是git@github.com后Download

2> 找到Swift.gitignore文件复制并粘贴到项目目录下(图一)-> 鼠标拖拽Swift.gitignore至Xcode打开如下(图二)->找到红框内容将“Pods/”前面的“#空格”都去掉->保存退出->回到目录下将Swift.gitignore文件名改成gitignore 如图一。


8. 打开Xcode创建项目,并保存在之前创建好的目录下,如下图可见红框内已无法打勾,表示项目git仓库已关联到OSChina上。

9. 打开SourceTree,按下图内容操作。

10. 回到OSChina上所创建的项目目录下,可见项目已经有刚在SourceTree所提交的修改内容。

11. 基于SourceTree若不注册只能用20天,注册还要Google账号,“手机验证”一项试了很多方法过不了,所以参考此博主得到许可证文件,许可证下载地址,然后把文件直接拉至下图红框内,就注册成功了。

至此,用SourceTree关联项目至OSChina上就完成了!
若此文章对你有用,请点“喜欢”支持一下。-/_\-
网友评论