1. 程式人生 > >Github使用總結(新增ssh-key,新建倉庫,新增協作者)

Github使用總結(新增ssh-key,新建倉庫,新增協作者)

今天為了把專案掛到Github上並且和組員協作好,研究了下Github的使用方法,現在做個總結記錄下來。

Step 1: Check for SSH keys

Have an existing keypair you'd like to use? You can skip to Step 4.

First, we need to check for existing ssh keys on your computer. Open up Terminal and run:

cd ~/.ssh# Checks to see if there is a directory named ".ssh" in your user directory

If it says "No such file or directory" skip to step 3. Otherwise continue to step 2.

Step 2: Backup and remove existing SSH keys

Since there is already an SSH directory you'll want to back the old one up and remove it:

ls# Lists all the subdirectories in the current directory
# config  id_rsa  id_rsa.pub  known_hosts
mkdir key_backup# Makes a subdirectory called "key_backup" in the current directory cp id_rsa* key_backup# Copies the id_rsa keypair into key_backup rm id_rsa*# Deletes the id_rsa keypair

Step 3: Generate a new SSH key

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

ssh-keygen -t rsa -C "[email protected]"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair.
# Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

Now you need to enter a passphrase.

# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

Which should give you something like this:

# Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db [email protected]

Step 4: Add your SSH key to GitHub

Run the following code to copy the key to your clipboard.

pbcopy < ~/.ssh/id_rsa.pub# Copies the contents of the id_rsa.pub file to your clipboard

Be warned: it is important to copy the key exactly without adding newlines or whitespace. Thankfully the pbcopy command makes it easy to perform this setup perfectly.

  1. Click "SSH Keys" in the left sidebar
  2. Click "Add SSH key"
  3. Paste your key into the "Key" field
  4. Click "Add key"
  5. Confirm the action by entering your GitHub password

Step 5: Test everything out

To make sure everything is working you'll now SSH to GitHub. When you do this, you will be asked to authenticate this action using your password, which for this purpose is the passphrase you created earlier. Don't change the [email protected] part. That's supposed to be there.

ssh -T [email protected]# Attempts to ssh to github

You may see this warning:

# The authenticity of host 'github.com (207.97.227.239)' can't be established.
# RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
# Are you sure you want to continue connecting (yes/no)?

Don't worry, this is supposed to happen. Verify that the fingerprint matches the one here and type "yes".

# Hi username! You've successfully authenticated, but GitHub does not
# provide shell access.

If that username is correct, you've successfully set up your SSH key. Don't worry about the shell access thing, you don't want that anyway.

If you see "access denied" please consider using HTTPS instead of SSH. If you need SSH start atthese instructions for diagnosing the issue.


2.新建倉庫

           2.1 在Github上登陸自己的賬號點選右上方的Create New Repo


2.2 填寫好自己的倉庫名,(例如CSDNTest)


2.3Github上新建好倉庫後在命令列執行如下指令(學過Git的應該知道是什麼意思)

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:chenyl107/CSDNTest.git
git push -u origin master
3.新增協作者

你的倉庫-->setting-->Collaborators,然後輸入你的協作者的使用者名稱 add就可以了


相關推薦

Github使用總結新增ssh-key新建倉庫新增作者

今天為了把專案掛到Github上並且和組員協作好,研究了下Github的使用方法,現在做個總結記錄下來。 Step 1: Check for SSH keys Have an existing keypair you'd like to use? You can

GitLab新增ssh-key操作無需每次輸入賬號密碼

       如今很多公司使用git來作為程式碼版本控制工具,現所在公司是自己搭建私人的GitLab來管理程式碼,每次clone、pull、push等操作時都需要輸入賬號密碼,如此十分繁瑣。後找到解決方案,就是在本地git客戶端生成ssh-key,配置到GitLab去。 解

github設定新增SSH key

很多朋友在用github管理專案的時候,都是直接使用https url克隆到本地,當然也有有些人使用 SSH url 克隆到本地。然而,為什麼絕大多數人會使用https url克隆呢?這是因為,使用https url克隆對初學者來說會比較方便,複製https url 然後到

iOS開發技巧之:SourceTree 新增 ssh key 方法

1.使用 git 客戶的生成公私鑰:id_rsa、id_rsa.pub 1.1設定Git的user name和email: $ git config --global user.name "xxx" $ git config --global user.email "[email&

git 新增ssh-key檢視config

本文轉載自http://blog.csdn.net/u013626215/article/details/51508085 侵權刪除 git config --list 檢視當前使用者資訊 >>>>>>>>>第一

Github – Generating a new SSH key

Github – Generating a new SSH key 1.生成 ssh keys ssh-keygen -t rsa -b 4096 -C "[email protected]" 2.config 檔案 # Public Github server Host github.co

多個github帳號的SSH key切換

也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!                一臺電腦上有一個ssh key,在github上提交程式碼,由於其他原因你可能會在一臺電腦上提交到不同的github上,怎麼辦呢...假設你電腦上一個ssh k

sourceTree 新增 ssh key 方法

1.使用 git 客戶的生成公私鑰:id_rsa、id_rsa.pub 1.1設定Git的user name和email: $ git config --global user.name "xx

github新建倉庫上傳本地專案

專案就暫時使用上一篇文章中,搭建的那個最原始的springmvcdemo專案: http://blog.csdn.net/u010372981/article/details/52000252 1.首先,登入github,點選new repository,會出現下面的介面

ElasticSearch 6.1.1 通過Head外掛新建索引新增文件及其查詢資料

ElasticSearch 6.1.1 通過Head外掛,新建索引,新增文件,及其查詢; 一、首先啟動相關服務: 二、新建一個film索引: 三、建立對映: 1、通過Head外掛: POST http://192.168.1.111:9200/film/_mappi

SourceTree新增SSH key訪問git

服務端小夥伴搭好了git伺服器,在win下開發,需要連線。 其中在win平臺,git客戶端用的是SourceTree+git官方包。(好像可以用SourceTree自嵌的git) 這裡,我只有git伺服器一個SSH的私鑰id_rsa,需要匯入到SourceTree中。 1

windows git:新增SSH key

git如果使用https協議,每次push時都會提示輸入使用者名稱和密碼,使用ssh祕鑰(git協議)則可以避免這一麻煩。 配置

總結3--- 知識總結內存管理、線程阻塞、GIL鎖

操作系統 python2.x 文件 訪問 外觀 python多線程 16px 重新 singleton 一、Python中是如何進行內存管理的? 垃圾回收:Python不像C++,Java等語言一樣,他們可以不用事先聲明變量類型而直接對變量進行賦值。對Python而言,對

數論 之 篩法總結艾托拉斯特尼篩法+尤拉篩法

1.篩法: 2.埃拉託斯特尼篩法(素數/質數篩選法): 2.1 步驟:      給出要篩數值的範圍n,找出以內的素數。先用2去篩,即把2留下,把2的倍數剔除掉;再用下一個素數,也就是3篩

Java 網路IO程式設計總結BIO、NIO、AIO均含完整例項程式碼

第一段內容轉載自:http://blog.51cto.com/stevex/1284437 先來個例子理解一下概念,以銀行取款為例: 同步 : 自己親自出馬持銀行卡到銀行取錢(使用同步IO時,Java自己處理IO讀寫)。 非同步

[Maven實戰]6倉庫本地倉庫遠端倉庫映象

1. 簡介 maven可以在某個位置統一儲存所有maven專案共享的構件,這個統一的位置就是倉庫。實際的Maven專案將不會各自儲存其依賴檔案,它們只需要宣告這些依賴的座標,在需要的時候(例如,編譯專案的時候需要將依賴加入到classpath中),maven會自動根據

Hibernate查詢方法總結包括條件分頁查詢、外來鍵id查詢

每天進步一點點,最近做專案用到了很多的hibernate的查詢方法。正好騰出時間來總結,希望對自己和他人都有幫助。 首先非常感謝施楊 's think out 和suntao1983做的總結,幫我解決的很多問題。 hibernate 的 六種基本查詢方法:分別是HQL查詢

02_創建Git倉庫克隆倉庫git add,git commit,git push,git pull,同行沖突不同行沖突的結局方案git mergetool的使用

round rom weight art sdn automatic remote then config 1 創建Git資源庫,殘酷文件夾信息 創建git資源庫的命令: git init –bare 倉庫名稱 (當中-bare表示的意思是空的庫的意思)

git生成ssh-key實現免密碼登入github

一 、 切到當前使用者的根目錄,右鍵選擇git bash,設定Git的user name和email: git config --global user.name "這裡換上你的使用者名稱" git config --global user.email "這裡換上你的郵箱"

新增、克隆~遠端倉庫 SSH key

                                          &nb