github提交代碼操作筆記

(備忘用,不一定正確)


* 提交代碼

cd xxx (切換到工作目錄)

git add . (注意後面的是一個點)

git commit -m 'adding xxx' (後面是日誌內容)

git push origin master (提交到origin節點的master分支,官方的做法是git push -r origin master)


Windows命令行創建ssh key(用於git clone [email protected]:xxx/xxx.git和提交私人倉庫代碼)

參考:

https://help.github.com/

https://help.github.com/articles/generating-ssh-keys/

https://help.github.com/articles/keeping-your-ssh-keys-and-application-access-tokens-safe/

https://help.github.com/articles/caching-your-github-password-in-git/

http://www.cnblogs.com/sheldonxu/archive/2012/09/17/2688281.html

 

環境:

Windows XP

Git-1.9.2-preview20140411(msysgit最新版http://msysgit.github.io/)

 

$ git config --global user.name <github註冊用戶名>
$ git config --global user.email <github註冊郵箱名>
$ ls -al ~/.ssh
$ ssh-keygen -t rsa -C <github註冊郵箱名>
(提示save the key時,直接回車(使用默認路徑保存鑰匙),然後輸入github註冊密碼(沒有迴響顯示,會提示輸入兩次))
$ ssh-agent -s(官方建議,不過有問題)
$ ssh-add ~/.ssh/id_rsa(失敗,改用ssh-agent bash)
$ ssh-agent bash
bash-3.1$ ssh-add ~/.ssh/id_rsa(成功)
(到了這裏需要手工把C:\Documents and Settings\Administrator\.ssh的id_rsa.pub文件內容粘貼到github網站->設置->SSH Keys (https://github.com/settings/ssh,點擊Add SSH Key按鈕),標題可以任意指定
$ ssh -T [email protected](測試,只要顯示authenticated就表示成功,不要理會shell access警告)
Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.
$ git clone [email protected]:xxx/xxx.git(在網頁上創建github代碼庫,然後使用右下角的SSH clone URL克隆代碼)

 

 

(以下引用http://www.cnblogs.com/sheldonxu/archive/2012/09/17/2688281.html

執行ssh-add時出現Could not open a connection to your authentication agent

若執行ssh-add /path/to/xxx.pem是出現這個錯誤:Could not open a connection to your authentication agent,則先執行如下命令即可:

  ssh-agent bash


更多關於ssh-agent的細節,可以用 man ssh-agent 來查看


(TODO:待補充)


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