將本地工程上傳到github

來源:互聯網
上載者:User

標籤:配置   提交   加密   key   project   工程   命令執行   .com   lob   

第一步:在github中添加密鑰

產生本地密鑰:

$ ssh-keygen -t rsa -C "[email protected]"  

命令執行後會提示產生的.ssh檔案夾的位置,進入開啟id_rsa.pub檔案,複製裡面的所有內容。

添加密鑰:

回到github,個人頭像下進入Settings,再進入SSH,new ssh key,填寫title,粘貼複製的密鑰。

第二步:本地項目上傳:

1.在Project根目錄下執行 git init,把工程轉化成git工程(工程中增加了.git檔案夾)。

2.在Project根目錄下配置提交的使用者名稱和mail地址:

git config --global user.name "yourname"  git config --global user.email "[email protected]"

3. 在Project根目錄下執行(在github上建立new repository,名為Project):

git remote add origin https://github.com/yourname/Project.git

執行完該命令後,.git/config檔案下增加如下內容:

[remote "origin"]url = https://github.com/yourname/Project.gitfetch = +refs/heads/*:refs/remotes/origin/*

4.執行提交流程:

git add .git commit -m "first commit" git push origin master (第一次需要加參數,後續直接git push即可)

執行後.git/config檔案增加如下內容:

[branch "master"]      remote = origin      merge = refs/heads/master

完成上傳

將本地工程上傳到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.