标签:
用SourceTree这个工具实现了上传项目。
首先,
1 :需要去sourceTree官网(https://www.sourcetreeapp.com)下载安装包,当然了如果你现在用的就是,那就剩下了很多功夫了,
2 :然后是注册GitHub账号,https://github.com/ -->Pricing and Signup -->Create a free account
3: 接下来是创建 SSh;
在local打开terminal:
$cd ~/.ssh 检查是否已经存在ssh
如果存在,先将已有的ssh备份,或者将新建的ssh生成到另外的目录下
如果不存在,通过默认的参数直接生成ssh
生成过程如下:
ssh-keygen -t rsa -C xxxxx@gmail.com(注册github时的email)
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/twer/.ssh/id_rsa): (见一个文件存放就行)
Created directory ‘/Users/twer/.ssh‘.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/twer/.ssh/id_rsa.
Your public key has been saved in /Users/twer/.ssh/id_rsa.pub.
The key fingerprint is:
18:16:11:c9:01:6c:48:09:7f:27:c6:43:0d:7f:3f:84 xxxxx@gmail.com
The key‘s randomart image is:
+--[ RSA 2048]----+
|.o.++=== |
|.ooo.+. . |
| ..* = E . |
| o = + o |
| . S o |
| . |
| |
| |
| |
+-----------------+
如果要修改ssh生成目录,在蓝色位置处输入要生成的路径,选择默认的话,会生成在 ~/.ssh下
<<18:16:11:c9:01:6c:48:09:7f:27:c6:43:0d:7f:3f:84 xxxxx@gmail.com>>这个就是生成的key
4: 在github中添加ssh(如图示):
登陆github,选择Account Settings-->SSH Keys 添加ssh
Title:xxxxx@gmail.com
Key:打开你生成的id_rsa.pub文件,将其中内容拷贝至此。
打开终端,先测试一下你的帐号跟github连上没有:ssh -T git@github.com 如果出现如下提示,表示你连已经连上了.(因为有了第一步,所以不用自己做过多的连接github的操作了,另外,下一次要连接github的时候记得打开第一步的工具).
等你的钥匙显示这个绿色的图标就就是你成功了
5: 接下来就可以上传你的代码了,在github下建自己的Repository。Create a New Repository如下:
- Repository name:通常就写自己自己要建的工程名。
- 选择Public。
- 点击 “Create repository”,出现如下图:
复制这个网址,打开sourceTree
6 :打开后点第一个

生成如下在界面

点击Clone 如图说明克隆成

点击 show in finder 后把我们创建的项目复制进去(是复制里边的所有文件)如图

接下来打开sourceTree 如图

按顺序点击1-2-3 出现下图 圆圈是填写这次修改了哪些东西 之后点击右下角commit

点击后 出现下图 点击pull 然后点击OK就可以轻松的把项目上传到github了 。

打开github后查看如下图片就说明成功了

使用SourceTree往GitHub 上管理代码
标签:
原文地址:http://www.cnblogs.com/cookiess/p/5367857.html