Git通过SSH提交工程到Github
来源:互联网 发布:录制长视频软件 编辑:程序博客网 时间:2024/05/29 10:40
1,创建一个SSH key
通过sshkeygen这个命令来创建 sshkey
双引号里的参数是你在github上的邮箱地址
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
这条命令会用你给的邮箱地址作为标签,创建一个ssh-key
Generating public/private rsa key pair.Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
这里需要你输入sshkey保存的位置,默认不修改,直接回车。
Enter passphrase (empty for no passphrase):Enter same passphrase again:
输入安全口令 ,不需要的话 默认回车
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.The key fingerprint is:....
完成创建ssh-key
添加SSH到ssh-agent:
启动ssh-angent
eval $(ssh-agent -s)
Agent pid 59566
添加sshkey到ssh-agent:
ssh-add ~/.ssh/id_rsa
2,添加SSH到Github账户
拷贝你的公钥。
$ clip < ~/.ssh/id_rsa.pub
或者用编辑器打开id_rsa.pub文件,拷贝字符串。
在你的github登录页面右上角,操作里选中settings。
在左侧的操作栏里选择SSH and GPG keys.
选择New SSH key 或者 Add SSH key
添加title,把剪贴板里的内容拷贝到Key输入框。
点击Add SSH key
系统会提示输入登录密码来验证。验证通过ok了。
3,Git提交工程文件
在github上创建一个新的仓库命名为yourgit.git。在你本地的文件夹创建一个git版本。
git initgit add *git commit -am"new profile"
推送到github上
git remote add origin git@github.com:yourname/yourgit.gitgit push -u origin master
注意:在github上创建的仓库一定要是空的,否则必须要先和服务器同步,才能提交。
错误参考:
执行 git remote add origin git@github.com:yourname/yourgit.git
提示 fatal: remote origin already exists.
操作 git remote rm origin
工具:
ssh-add -l
显示添加的ssh
ssh -T git@github.com
登录github。运行成功会提示:Hi xxx !You’ve successfully authenticated, but GitHub does not provide shell access。
参考地址generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- Git通过SSH提交工程到Github
- 笔记:Git Bash ssh key配置及首次提交本地工程到github(Windows )
- git提交到github
- git提交到github
- git提交到github
- git提交到github
- git提交到github
- git提交到github
- git初始化邮箱和将ssh提交到github上
- 通过 Git 将代码提交到 GitHub(上)
- 通过 Git 将代码提交到 GitHub(下)
- 如何通过Git命令行把代码提交到github上
- 提交androidstudio工程到GitHub
- Git提交项目到Github
- git提交代码到github
- git提交代码到github
- Git 提交代码到github
- Git 使用——如何将本地目录下的 android 工程提交到github上去?
- 最大似然估计算法(极大似然估计算法)
- AOP:PostSharp和Castle DynamicProxy
- [Leetcode 153 && 154] Find Minimum in Rotated Sorted Array (II)
- oracle删除表空间
- Android Studio初次使用genymotion注意几点
- Git通过SSH提交工程到Github
- CopyOnWriteArrayList实现原理
- [读书笔记]《STL源码剖析》
- 【EXPDP】Oracle expdp中并行问题
- Android TextView跑马灯不动
- springboot集成swagger2
- MTK android dirver 专业词汇注释汇总
- xcode UI test with xctest
- 微信小程序开发 | 官方问答精选