oschina git 私有項目使用。。


 

 

 

工作流程


安裝設置 git

下載最新版本的git

http://git-scm.com/downloads

當你安裝完成git的時候,你需要簡單的配置一下,打開終端:

用戶名

第一步,你需要告訴git你的名字,這個名字會出現在你的提交記錄中。

git config --global user.name "你的名字"

Email

然后是你的Email,同樣,這個Email也會出現在你的提交記錄中,請盡量保持此Email和您的Git@OSC的注冊Email一致。

git config --global user.email "你的Email"

Clone 和 Push

Clone 項目

git clone http://git.oschina.net/xxxxxx/xxxxxx.git

創建特性分支

git checkout -b $feature_name

寫代碼,提交變更

git commit -am "My feature is ready"

將你的提交推送到 Git@OSC

git push origin $feature_name

在提交頁面你可以查看你的變更,例如:

http://git.oschina.net/oschina/git-osc/commit/f3dd1c5bae48fa4244e2595a39e750e5606dd9be

創建一個 pull request

你可以fork任意的公開項目,當你修改了你fork的項目,你可以向源項目提交pull request。項目的作者在審閱過代碼后可以決定是否將此變更應用到源項目。


SSH Keys


SSH key 可以讓你在你的電腦和 Git @ OSC 之間建立安全的加密連接。

你可以按如下命令來生成sshkey

ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...

查看你的public key,並把他添加到 Git @ OSC http://git.oschina.net/keys

cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

添加后,在終端(Terminal)中輸入

ssh -T git@git.oschina.net

若返回

Welcome to Git@OSC, yourname! 

則證明添加成功。

 

然后在你的項目中添加鑰匙。。。

 

最后記得是使用ssh地址clone你的項目。。。

 

 

 

 

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM