原文:Github使用总结(添加ssh-key,新建仓库,添加协作者)
今天为了把项目挂到Github上并且和组员协作好,研究了下Github的使用方法,现在做个总结记录下来。
1.添加ssh-key(该部分转自Github官网 https://help.github.com/articles/generating-ssh-keys)
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 "your_email@example.com"# 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 your_email@example.com
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.
- Go to your Account Settings
- Click "SSH Keys" in the left sidebar
- Click "Add SSH key"
- Paste your key into the "Key" field
- Click "Add key"
- 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 git@github.com
part. That's supposed to be there.
ssh -T git@github.com# 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 git@github.com:chenyl107/CSDNTest.git git push -u origin master
3.添加协作者
你的仓库-->setting-->Collaborators,然后输入你的协作者的用户名 add就可以了
相关推荐
快速为Github设置SSH密钥 1.克隆此项目 git clone https://github.com/martinandersen3d/github-ssh-key-setup.git ...cd github-ssh-key-setup/ ./github-ssh-setup.sh 3.在以下位置添加密钥: 示范
python库。 资源全名:github_ssh_key-0.2.0-py3-none-any.whl
ssh-agent GitHub操作这个动作启动ssh-agent , 导出SSH_AUTH_SOCK环境变量, 将一个或多个私有SSH密钥加载到代理中,然后为GitHub.com配置known_hosts 。 它应该可以在所有GitHub Actions虚拟环境中使用,包括基于...
设置SSH Github操作 此操作将添加SSH密钥,并将给定的主机名或IP地址添加到已知的主机文件中,以供外部服务器访问。 它受到了极大启发。 例如,您可以在使用scp或rsync将文件复制到外部服务器之前运行此操作。 输入...
github-action-wpengine-ssh-deploy 改变1 改变2
用法将buildpack添加到您的应用程序: heroku buildpacks:add --index 1 https://github.com/simon0191/custom-ssh-key-buildpack 生成一个新的SSH密钥( ) 对于此示例,我假设您将键命名为deploy_key 。 将ssh密钥...
:rocket: SSH for GitHub操作 用于执行远程ssh命令的动作。 重要提示:仅支持Linux 容器。 输入变量 有关更多详细信息,请参见 。 host -ssh主机 port -ssh端口,默认为22 username -ssh用户名 password -ssh密码...
简单的GitHub Action,可使用SSH在远程服务器上运行命令。 这与最新的。 :sparkles: 用法示例 使用OpenSSH加密私钥的示例 - name : ls -a via ssh uses : garygrossgarten/github-action-ssh@release with : ...
GitHub个人资料摘要卡此仓库受启发 :star: 此回购只是为了好玩,随时可以贡献! :star: 该操作将生成您的github个人资料摘要卡,并提交到您的存储库。 添加此动作后,您也可以自己触发动作。例子如何使用 :star: ...
使用此文件配置ssh代理,配置git通过proxy访问github
github-user-publickey 获取GitHub用户PublicKey 安装 > npm install --save github-user-publickey 用法 var githubUserPublicKey = require ( 'github-user-publickey' ) ; githubUserPublicKey ( cli . input ...
ssh-url-with-ssh-key:用于将SSH密钥嵌入SSH URL的SSH包装器
GitHub桌面 专注于重要的事情,而不是与Git战斗。无论您是Git的新手还是经验丰富的用户,GitHub Desktop都可以简化您的开发工作流程。 与协作者轻松提交属性 快速将共同作者添加到您的提交中。非常适合配对,也非常...
该文档适用于小白使用,讲述了在遇到问题时,如何添加SSH key。
使用ssh-import-id,您可以从已知的可信在线身份添加公共SSH密钥,以授予SSH访问权限。 当前支持的身份包括Github和Launchpad。用法ssh-import-id使用短前缀指示在线身份的位置。 现在,这些是: 'gh:' for Github'...
您用于GitHub Pages的GitHub学习实验室存储库欢迎你的资料库为您的GitHub学习实验室课程。 在我将指导您完成的各种活动中将使用该存储库。 哦! 我还没有自我介绍... 我是GitHub Learning Lab机器人,我在这里可以...
ssh-ca, 用于支持ssh密钥的证书颁发机构的管理实用程序 新项目公告我们知道如何使这个... 那个项目在这里:https://github.com/cloudtools/ssh-cert-authorityssh的作者建议最新和最大的更新和支持使用ssh-cert-autho
categories: [其他]tags : [github, alfred, blog]keywords : github page, alfred work
该操作将生成您的github个人资料摘要卡,并推送到您的存储库。 添加此动作后,您也可以自己触发动作。 Github配置文件摘要卡繁体中文此存储库受profile-summary-for-github的启发,此操作将生成github配置文件摘要卡...