標籤:ide shell 顯示 push 個人 fan his 建倉 上傳檔案
1首先需要在github上建立你自己的github賬戶
2建立倉庫(注意選擇initialize this repository with a README)
3產生ssh(公開金鑰.pub&私密金鑰)
命令列:$ssh-keygen -t rsa -C [email protected](註冊github時的email)
接下來需要指定產生ssh所在的目錄:可以不僅僅指定~/.ssh,因為有時候公司的gitlab上需要一個ssh,個人的github上的ssh需要重建,這時就可以在一個新的目錄下產生,目錄/github_rsa (這個名稱可以自己指定)
4在github上的settings->ssh keys 添加自己的github_rsa.pub檔案,可以在命令列中cat github_rsa.pub開啟此檔案,複製全部內容到github的key中。添加。
5在本地的電腦上添加私密金鑰
命令列:ssh-add github_rsa ,如果未寫該命令,驗證便不會成功。
6 驗證是否串連成功
命令列:$ ssh -T [email protected]
如果此時響應:Hi encoreMiao! You‘ve successfully authenticated, but GitHub does not provide shell access.便是配置成功了
7上傳檔案
clone剛才在github上建立一個repository倉庫到本地,將要上傳的項目拖到這個檔案夾中,便可進行commit,pull,push操作了。
ps:同樣也可以在本地,建立倉庫命令列代碼如下:
$ touch README
$ git init //初始化
$ git add README //更新README檔案
$ git commit -m ‘first commit‘ //提交更新,並注釋資訊“first commit”
$ git remote add origin [email protected]:defnngj/hello-world.git //串連遠程github項目 (這裡是自己建立名字)
$ git push -u origin master //將本地項目更新到github項目上去
ps:finder中顯示隱藏檔案夾
命令列:defaults write com.apple.finder AppleShowAllFiles -bool true
參考:
http://blog.csdn.net/leikezhu1981/article/details/47664215
https://my.oschina.net/stefanzhlg/blog/529403
MAC上向GitHub上上傳自己的項目