MAC上向GitHub上上傳自己的項目

來源:互聯網
上載者:User

標籤: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上上傳自己的項目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.