git的版本管理使用(二)-克隆代碼到本地

git系列文章

一、 git的版本管理使用(一)-初識git

二、git的版本管理使用(二)-克隆代碼到本地

三、git的版本管理使用(三)-拉取分支代碼

參考文章

廖百萬–初次學習git可以查看這篇文章,講的很全面

主要講git同一賬號在不同電腦上,加載相同的項目:
1.第一步:將項目克隆到本地,(相當於下載了源碼)
這裏寫圖片描述

**$ git clone https://github.com/hytcyjb/xxx.git**

返回值:(下載中:)

Administrator@WIN-0UR4RGO6JBB MINGW64 /e/yjbo/sougu/code/mygit (master)
$ git clone https://github.com/hytcyjb/xxx.git
Cloning into 'xxx'...
remote: Counting objects: 110, done.
remote: Compressing objects: 100% (12/12), done.
d 0 (delta 0), pack-reuRecesed 95
Receiving objects: 100% (110/110), 97.37 KiB | 0 bytes/s, done.
Resolving deltas: 100% (17/17), done.
Checking connectivity... done.


說明:如果你第一步使用的是:(此處爲錯誤的使用方法

這裏寫圖片描述

**$ git clone git@github.com:hytcyjb/xxx.git**

錯誤時的,返回值是:

Administrator@WIN-0UR4RGO6JBB MINGW64 /e/yjbo/sougu/code/mygit (master)
$ git clone [email protected]:hytcyjb/xxx.git
Cloning into 'xxx'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to t                            he list of known hosts.
xxx denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.


所以一定得克隆https的那個鏈接。

2.提交項目內容到git上: 分四步:(也是正常操作git的基本操作)
(1).gitadd.2. git commit -m “上傳說明”
(3).$ git pull https://github.com/hytcyjb/xxx.git
(4).$ git push https://github.com/hytcyjb/xxx.git
第四步之後得輸入用戶名和密碼,(如果項目就是自己的就可以上傳了,如果項目不是自己的得得到原項目作者的“同意”相當於把你的名字加進去就行)


至此,就可以git的克隆和上傳。

具體將代碼在as中與git關聯的操作,請參考http://my.oschina.net/u/2367628/blog/508283

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章