iOS 到Github

(一.ssh的簡(jiǎn)單使用,二.push一個(gè)項(xiàng)目到GitHub)
一.生成ssh

1.首先查看當(dāng)前MAC的終端有沒(méi)有安裝GIT

根目錄下直接輸入:git
若顯示如下內(nèi)容愧沟,恭喜你已經(jīng)安裝git限府,不然需要在安裝一個(gè)git(這里就不細(xì)說(shuō)git的安裝過(guò)程)
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status

grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Forward-port local commits to the updated upstream head
tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

2.已知MAC上git,接下來(lái)新建SSH-key(用來(lái)和github上連接)

終端輸入: ssh-keygen -t rsa -C your@mail.com(此處填寫Github上的郵箱地址)
然后終端會(huì)顯示:

#這里以指定key例子(中間一直按Enter鍵)
Generating public/private rsa key pair.Enter file in which to save the key (/root/.ssh/id_rsa): 
/home/git/.ssh/id_gitEnter passphrase (empty for no passphrase):
 #密碼設(shè)置為空,如果設(shè)置了密碼,客戶端使用,需有記住此Key密碼的功能
Enter same passphrase again:
Your identification has been saved in /tmp/id_test.
Your public key has been saved in /tmp/id_test.pub.
The key fingerprint is:db:c8:37:24:56:08:b8:c5:d5:8e:f3:60:84:d6:fb:a0 root@i-25BDB9AF
The key's randomart image is:
+--[ RSA 2048]----+
| o.+.. |
| . =.o.. |
| + ..+. |
| . B.. |
| oS*. |
| Eo *o |
| + + |
| . . |
| |
+-----------------+
`到這里就已經(jīng)生成完了`

3.這時(shí)在終端輸入:ls -a(可以查看當(dāng)前所有的文件包括隱藏的,找到.ssh的文件)
接著在終端輸入:open .ssh(打開(kāi)文件,找到id_rsa.pub文件打開(kāi),復(fù)制里面的文件內(nèi)容)
4.打開(kāi)github點(diǎn)擊你的頭像\settings\SSH and GPG keys\New ssh key 這里的Title (可以隨意寫)key(把上個(gè)步驟復(fù)制的粘貼到這里)最后不要忘了Add SSH key.
二.push 一個(gè)項(xiàng)目到guthub

1.在Github上新建一個(gè)項(xiàng)目;
2.終端中輸入:cd 當(dāng)前項(xiàng)目的目錄
3.終端中輸入:git init (初始化)
4.終端中輸入:git add . (添加)
5.終端中輸入:git commit -m"(此處輸入與你項(xiàng)目有關(guān)的:如XX第一次提交)"
6.終端中輸入:git remote add origin(此處填github上clone or downdload/Clone with ssh 上面的地址)

7.終端中輸入:git pull origin master
8.終端中輸入:git push origin master -f(直接推到github上)

會(huì)顯示類似如下的內(nèi)容:

Counting objects: 208, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (204/204), done.
Writing objects: 100% (208/208), 920.10 KiB | 147.00 KiB/s, done.
Total 208 (delta 25), reused 0 (delta 0)
remote: Resolving deltas: 100% (25/25), done.
To git@github.com:XXXXXXXXXXXXX
 + 53d955e...38d2198 master -> master (forced update)
```
這樣就已經(jīng)上傳成功了白嘁,可以到Github上看到你的項(xiàng)目了。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末膘流,一起剝皮案震驚了整個(gè)濱河市絮缅,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌呼股,老刑警劉巖耕魄,帶你破解...
    沈念sama閱讀 221,430評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異彭谁,居然都是意外死亡屎开,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,406評(píng)論 3 398
  • 文/潘曉璐 我一進(jìn)店門马靠,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)奄抽,“玉大人,你說(shuō)我怎么就攤上這事甩鳄〕讯龋” “怎么了?”我有些...
    開(kāi)封第一講書人閱讀 167,834評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵妙啃,是天一觀的道長(zhǎng)档泽。 經(jīng)常有香客問(wèn)我俊戳,道長(zhǎng),這世上最難降的妖魔是什么馆匿? 我笑而不...
    開(kāi)封第一講書人閱讀 59,543評(píng)論 1 296
  • 正文 為了忘掉前任抑胎,我火速辦了婚禮,結(jié)果婚禮上渐北,老公的妹妹穿的比我還像新娘阿逃。我一直安慰自己,他們只是感情好赃蛛,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,547評(píng)論 6 397
  • 文/花漫 我一把揭開(kāi)白布恃锉。 她就那樣靜靜地躺著,像睡著了一般呕臂。 火紅的嫁衣襯著肌膚如雪破托。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書人閱讀 52,196評(píng)論 1 308
  • 那天歧蒋,我揣著相機(jī)與錄音土砂,去河邊找鬼。 笑死谜洽,一個(gè)胖子當(dāng)著我的面吹牛瘟芝,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播褥琐,決...
    沈念sama閱讀 40,776評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼晤郑!你這毒婦竟也來(lái)了敌呈?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書人閱讀 39,671評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤造寝,失蹤者是張志新(化名)和其女友劉穎磕洪,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體诫龙,經(jīng)...
    沈念sama閱讀 46,221評(píng)論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡析显,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,303評(píng)論 3 340
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了签赃。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片谷异。...
    茶點(diǎn)故事閱讀 40,444評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖锦聊,靈堂內(nèi)的尸體忽然破棺而出歹嘹,到底是詐尸還是另有隱情,我是刑警寧澤孔庭,帶...
    沈念sama閱讀 36,134評(píng)論 5 350
  • 正文 年R本政府宣布尺上,位于F島的核電站材蛛,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏怎抛。R本人自食惡果不足惜卑吭,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,810評(píng)論 3 333
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望马绝。 院中可真熱鬧豆赏,春花似錦、人聲如沸迹淌。這莊子的主人今日做“春日...
    開(kāi)封第一講書人閱讀 32,285評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)唉窃。三九已至耙饰,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間纹份,已是汗流浹背苟跪。 一陣腳步聲響...
    開(kāi)封第一講書人閱讀 33,399評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留蔓涧,地道東北人件已。 一個(gè)月前我還...
    沈念sama閱讀 48,837評(píng)論 3 376
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像元暴,于是被迫代替她去往敵國(guó)和親篷扩。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,455評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容

  • afinalAfinal是一個(gè)android的ioc茉盏,orm框架 https://github.com/yangf...
    passiontim閱讀 15,435評(píng)論 2 45
  • 因?yàn)樵奶L(zhǎng)超出字?jǐn)?shù)鉴未,Lesson 3 就放在另一篇文章里 How to Use Git and GitHub 標(biāo)...
    赤樂(lè)君閱讀 5,227評(píng)論 1 5
  • (一) 喜歡一邊走路一邊與兒子聊天。經(jīng)常會(huì)央他講一些學(xué)校里的趣事給我聽(tīng)鸠姨,以便更近地接觸他的校園生活铜秆。隨著他從低年級(jí)...
    凌星虹閱讀 506評(píng)論 2 9
  • 高考已告一段落,萬(wàn)千學(xué)子馬上就要步入大學(xué)生活讶迁。相對(duì)來(lái)說(shuō)连茧,大學(xué)生活沒(méi)有了初高中那樣繁重的學(xué)業(yè)負(fù)擔(dān),時(shí)間自由巍糯、充裕啸驯,我...
    小芙哈哈閱讀 1,787評(píng)論 2 57
  • 當(dāng)夜晚降臨,不召喚祟峦,不受召坯汤,睡眠成了道德之主,除非你與鄰人的魔鬼相安無(wú)事搀愧,否則惰聂,他會(huì)夜間到你身邊來(lái)作祟疆偿。 嗜睡者是...
    看海聽(tīng)閱讀 194評(píng)論 0 0