zoukankan      html  css  js  c++  java
  • XCode中连接使用GitHub

    之前有写了两篇在windows下使用Visual Studio连接GitHub的文章,有需求的可以去看一下。windows中使用Git工具连接GitHub(配置篇)在Visual Studio中使用GitHub(使用篇)

    本文是讲在Mac OS中使用XCode连接GitHub。

    软件版本:

    Mac OS 10.7.4

    XCode 4.3.2

    不需要另行安装任何软件,XCode的默认源码管理软件就是Git。所以我们要做的只是配置而已。

    红色为输入命令 蓝色为自行输入的参数 绿色为注释 色为您系统参数

    一、为您的SSH生成密钥

    jomatoMac-mini:~ sorex1984$ ssh-keygen -t rsa -C "your_email@youremail.com"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/Users/sorex1984/.ssh/id_rsa): abcde[文件名]
    Enter passphrase (empty for no passphrase): [密码必须大于4位]
    Enter same passphrase again: [再次输入密码]
    Your identification has been saved in abcde.
    Your public key has been saved in abcde.pub.
    The key fingerprint is:
    ea:74:df:7d:29:de:c9:37:80:49:be:d9:5c:9e:03:94 your_email@youremail.com
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |                 |
    |              .  |
    |           . E   |
    |        S o +    |
    |       .   + o . |
    |      o .   = = o|
    |     o . . + =o*+|
    |      .   . o.o=+|
    +-----------------+

    在/Users/sorex1984/文件夹下我们会看到有abcdeabcde.pub两个文件

    二、在GitHub网站上的SSH Key中加入abcde.pub的内容

    这里就不详细描述了,不知道怎么加的可以去看windows中使用Git工具连接GitHub(配置篇) 

    三、添加SSH到管理器并测试连接

    jomatoMac-mini:~ sorex1984$ ssh-add ~/abcde

    jomatoMac-mini:~ sorex1984$ ssh -T git@github.com

    The authenticity of host 'github.com (207.97.227.239)' can't be established.RSA key fingerprint is ea:74:df:7d:29:de:c9:37:80:49:be:d9:5c:9e:03:94.Are you sure you want to continue connecting (yes/no)?

    jomatoMac-mini:~ sorex1984$ yes

    Hi username! You've successfully authenticated, but GitHub does not provide shell access.

    四、关联项目

    cd 项目文件夹

    git remote add origin git@github.com:sorex/iPhoneStudy.git[项目地址]

    git pull -u origin master[从网址拉取项目]

    git push -u origin master[向网站提交项目]

    五、XCode中提交项目

    提交到本地:选择要 更新的文件  右键 –> Source Control –> Commit Selected Files [填写注释]

    提交到GitHub:File菜单–> Source Control–> Push… –> 选择Remote[一般选择origin/master]

    从GitHub获取:File菜单–> Source Control–> Pull… –> 选择Remote[一般选择origin/master]

    设置个人信息

    $ git config --global user.name "sorex"

    $ git config --global user.email "sorex1984@gmail.com"

    到此全部完毕您可以使用GitHub来同步或者发布您的代码了。

    注:每次重启MAC OS后都需要重新添加key文件

    ssh-add ~/abcde

    ssh -T git@github.com

  • 相关阅读:
    AOV网和AOE网对比
    AOV网和AOE网对比
    Python类型总结
    Python数据结构
    Django之认证系统
    day22笔记
    数据库概念知识
    pymsql模块使用
    多表查询(子查询)
    多表查询(链接查询)
  • 原文地址:https://www.cnblogs.com/sorex/p/2517763.html
Copyright © 2011-2022 走看看