github 使用总结

参考:https://help.github.com/articles/generating-ssh-keys#platform-linux


1、生成ssh key

ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]
    

2、添加 new key 到 ssh-agent

ssh-add ~/.ssh/id_rsa

3、将pub key 上传到github

   将 ~/.ssh/id_rsa.pub 中的内容粘贴到github  ssh key中


4、测试连接是否正常

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

5、同步服务器中的仓库:

  

  1. $ git config --global user.name "your name"
  2. $ git config --global user.email "[email protected]"
  3. $ git clone [email protected]:yourname/yourRepo.git

6、提交上传:
git add README
git commit -m "first commit"
git push origin master

你可能感兴趣的:(github 使用总结)