1. 程式人生 > >Windows下github使用說明

Windows下github使用說明

1. 下載git客戶端

這裡用msysgit 下載地址

2. 建立專案

登入github,點選New repository
Repository name:Hello-World

$ git config --global user.name "YourName"
$ git config --global user.email "YourE-mail"
$ git config --lis

$ cd ~/github/    #在該資料夾中管理github專案
$ mkdir Hello-World    #在本地建對應的repository
$ cd Hello-World
/ $ git init $ touch README.md $ git add README.md $ git commit -m 'first commit' #提交記錄說明 $ git remote add origin https://github.com/YourName/Hello-World.git $ git push origin master

3. 建立SSH KEY

3.1 檢查原有金鑰

$ cd ~/. ssh    #檢查本機的ssh金鑰

如果有此資料夾,說明不是第一次使用,執行下面的操作,清理原有ssh金鑰。

$ mkdir key_backup
$ 
cp *_rsa* key_backup $ rm *_rsa*

3.2 生成新的金鑰

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

這裡的郵箱是自己的郵箱地址,回車之後會讓你輸入儲存金鑰的檔名,這裡輸入id_rsa。最後會得到id_rsa和id_rsa.pub兩個檔案,前者是私鑰,後者是公鑰。

3.3 新增金鑰

新增私鑰到ssh:

$ ssh-add id_rsa

如果報錯:Could not open a connection to your authentication agent.
先執行一下:

$ 
ssh-agent bash

再執行 ssh-add id_rsa。
將公鑰新增到github中,Personal settings中選擇SSH keys,在New SSH Key中Title填寫本機的名字,Key是把公鑰檔案的內容貼進來。

3.4 測試一下

$ ssh git@github.com

如果出現下面內容,說明連線成功了

PTY allocation request failed on channel 0
Hi YourName! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

如果出現如下的問題

ssh_exchange_identification: read: Software caused connection abort

可以使用

$ ssh [email protected]
The authenticity of host 'github (10.254.180.205)' can't be established.
ECDSA key fingerprint is SHA256:BJamnZU+s3Xtgo/m13oBw9hw6CBdMUtnkCKeZJq0knU.
Are you sure you want to continue connecting (yes/no)? **yes**
Warning: Permanently added 'github,10.254.180.205' (ECDSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi ***! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github closed.

出現上述結果也表明連線成功了。

4 開始使用

4.1 獲取原始碼

$ git clone https://github.com/Eaton18/Hello-World.git

後面的連結是專案在github中的地址。

4.2 獲取版本更新

假如本地已經存在了這個專案,而倉庫中又有更新,獲取更新:

$ git fetch origin    #取得遠端更新,這裡可以看做是準備要取了
$ git merge origin/master  #把更新的內容合併到本地分支/master

4.3 提交本地修改的版本

本地編輯了專案之後,將當前版本上傳到倉庫中

$ git add *
$ git status    #可以看到我們對哪些檔案做了修改
$ git push origin master

4.4 刪除倉庫中的檔案

$ git status
$ git rm hehe/hello.txt
$ git commit -m 'del txt'
$ git push origin master

相關推薦

windows GitHub的使用方法

1.首先去github官網註冊一個賬號,(如何註冊,聰明人都知道,這裡就省略了) 2.去https://desktop.github.com/這裡下載一個github桌面版   下載完成後,雙擊執行github,選擇第一個: 點選加號

[轉載]windowsgithub 出現Permission denied (publickey).解決方法

    今天在學習github的時候遇到了一些問題,然後爬了一會,找到了解決方法記錄下來,以防忘記,當然能幫助別人最好啦! github教科書傳送門:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18

windowsgithub的ssh方式免密配置

檢查本機是否有ssh key設定 $ cd ~/.ssh 或cd .ssh 如果沒有則提示: No such file or directory

windowsgithub的使用心得

       最近對linux很是感興趣,就在自己的pc機上搞了個雙系統--windows 和 linux。主要是為了學校裡各種作業和聯絡什麼的,沒辦法只能保留windows。某天突然想學習QT了,就下了個QT的原始碼包,準備手動編譯安裝,結果無奈不知何原因安裝失敗了。無奈

Windowsgithub使用說明

1. 下載git客戶端 這裡用msysgit 下載地址 2. 建立專案 登入github,點選New repository Repository name:Hello-World $ git config --global user.name

Windows用Composer引入官方GitHub擴展包

ads 5.0 uic 加載 .json 環境 新建文件夾 內部命令 安裝 Windows下用Composer引入官方GitHub擴展包 1. 當你打開威武RC4版本的鏈接的時候,往下拉你可以看到這個,然後你要做的就是想到,百度Composer,看看是個什麽鬼,別想太多,跟

windows怎麽生成github的ssh公鑰

email ssh-key -c 根目錄 ini ssh公鑰 windows 文件 公鑰 windows下如何生成github的ssh公鑰: 1. 安裝git,打開Git Bash 2. 鍵入命令:ssh-keygen -t rsa -C "email@email.

使用Windows的git工具往github上傳代碼 踩坑記錄

from push 進行 其中 一個 access HA png 關聯 使用Windows下的git工具往github上傳代碼 踩坑記錄 背景 由於以前接觸的項目都是通過svn進行版本控制,現在公司項目使用git,加上自己平時有一個練手小項目,趁著周末試著把項目上傳到自己

windows將檔案上傳到GitHub

1、下載兩個軟體,安裝在電腦上 Git-2.19.0-64-bit.exe TortoiseGit-2.7.0.0-64bit.msi 安裝 2、在桌面上新建一個資料夾 如:testgithub 裡面放著自己要上傳的檔案。 然後右鍵: 然後依次選擇:o

windows生成github ssh key詳解

一、ssh是什麼:ssh是Secure Shell(安全外殼協議)的縮寫,建立在應用層和傳輸層基礎上的安全協議。為了便於訪問github,要生成ssh公鑰,這樣就不用每一次訪問github都要輸入使用者名稱和密碼。 二、 1.在本地成功安裝好Git之後。單擊滑鼠右鍵,選擇Git Bush h

windows建立連線github程式碼倉庫的公鑰

1、確定自己安裝了git 2、開啟git Bash 3.命令列輸入: 格式:ssh-keygen -t rsa -C "[email protected]" 例子:ssh-keygen -t rsa -C "[email protected]"

windows環境github + beego嘗試

先安裝本地配置GO環境,配置GitHub環境,在github上建立帳戶 開啟github shell,執行:go get github.com/beego/bee 報錯: # cd .; git clonehttps://github.com/beego/bee e:

Windows配置Github 的SSH Key

一、開啟 Git Bash,輸入如下命令,然後連續按三個回車即可: ssh-keygen -t rsa -C "[email protected]"                      

Windowsgit連線GitHubgithub.com)、碼市(coding.net)、碼雲(gitee.com)

1、安裝git與註冊 git下載安裝及簡單使用請參考:傳送門 在三個網站分別進行註冊,本人比較懶,使用相同的使用者名稱、郵箱及密碼進行註冊 2、設定公鑰 git生成公鑰鑰,使用如下命令: $ ssh-keygen -t rsa -C "[email&#

windowsgithub的mergetool設定為 beyond compare 4 (bc4) 的方法

如果bc4的安裝路徑不是預設路徑,則需要以下修改: 首先找到github的安裝路徑下的gitconfig檔案 我的在以下位置: D:\Users\****\AppData\Local\GitHub\PortableGit_c2ba306e536fdf878271f7fe

第一次瞭解GitHub,在Windows使用GitHub

心血來潮——看了一下關於版本管理工具Git 要使用GitHub(一個程式設計師的社群網站,基於Git用於託管軟體庫),個人覺得要先理解Git和GitHub。 這裡有兩個參考網站,可以做了解:  

如何在Windows新增Github的SSH公鑰

  建立本地SSH(一種傳輸程式碼的方法,速度快安全。詳細可去百度查資料)(也可以選擇HTTPS傳輸,那就跳過此步) Github郵箱:該命令後面的郵箱就是Github的註冊郵箱;路徑選擇:使用該命令之後,會出現提示選擇SSH-KEY生成路徑,這裡直接

windows配置hexo+github,hexo設定,markdown語法

配置環境 建立部落格目錄 $ hexo init <folder> //我的folder名字是blog,後面都用這個名字說明 $ cd <folder> $ npm install 寫部落格 注意需

TortoiseGit和msysGit安裝及使用筆記[windows使用上傳資料到GitHub]

TortoiseGit和msysGit安裝及使用筆記(windows下使用上傳資料到GitHub) TortoiseGit和msysGit安裝及使用筆記(windows下使用上傳資料到GitHub) 一、想要使用TortoiseGit,首先應該安裝msysGit,因為To

Windows如何將一個資料夾通過Git上傳到GitHub上?

在通過windows系統的電腦上寫程式碼,需要將專案上傳到GitHub上去。比如在Pycharm上寫Django後端,整個專案是一個資料夾的形式,那麼怎麼才能這個資料夾通過Git命令上傳到GitHub上呢? 以下給出詳細步驟: 1、首先得安裝git客戶端