Git & github 最常用操作笔记
2014-11-16 19:42
344 查看
基本配置
查看已有配置信息可用
开始使用git
到项目所在的目录,执行
添加与提交文件
生成SSH密钥过程(用于连接github)
查看是否已经有了ssh密钥:
如果没有密钥则不会有此文件夹,有则备份删除
生成密钥:
最后得到了两个文件:id_rsa和id_rsa.pub
登录github,添加 id_rsa.pub 里面的公钥。
测试:
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)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
本地已有代码,推送到一个远程仓库上
克隆一个远程仓库
将本地repo与远程的origin的repo合并
推送本地更新到远程仓库
远程仓库更新到本地
git config --global user.name "foobar" git config --global user.email "foo@bar.com" git config --global core.editor vim git config --global color.ui true git config --global merge.tool vimdiff
查看已有配置信息可用
git config --list
开始使用git
到项目所在的目录,执行
git init
添加与提交文件
git add *.c git commit -m "first commit"
生成SSH密钥过程(用于连接github)
查看是否已经有了ssh密钥:
cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
生成密钥:
ssh-keygen -t rsa -C "foo@bar.com"
最后得到了两个文件:id_rsa和id_rsa.pub
登录github,添加 id_rsa.pub 里面的公钥。
测试:
ssh git@github.com
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)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
本地已有代码,推送到一个远程仓库上
git remote add origin https://github.com/foo/bar.git git push -u origin master
克隆一个远程仓库
git clone git@github.com:billyanyteen/github-services.git
将本地repo与远程的origin的repo合并
推送本地更新到远程仓库
git push -u origin master
远程仓库更新到本地
git pull origin master
相关文章推荐
- Git&GitHub学习笔记之(一)GitHub简单操作
- Git&Github操作笔记
- Git&GitHub学习笔记之(二)Git命令操作
- 【Git/Github学习笔记】Git常用命令(代码冲突二)
- git常用操作笔记
- git&github使用笔记(二)——Git设置文件忽略
- 【Git/Github学习笔记】Git常用命令(推送到远程)
- Git & Github 一页简明笔记(转)main
- 【笔记】git 的常用操作命令(持续更新。。。)
- 【Git学习笔记】Github与本地仓库的交互操作
- 【github&&git】4、git常用命令(持续更新中)
- 【Git/Github学习笔记】Git常用命令(版本回退)
- git和github的代码托管常用命令和操作
- Git&GitHub学习笔记之(三)Git向GitHub提交代码
- [Github]msysgit的使用&Git常用命令
- GitHub入门与实践学习笔记--github学习基础之关于git的基本操作
- git与github常用指令--学习笔记
- Git学习笔记之<撤销操作>
- Git&Github学习笔记
- Git笔记——Git的常用指令和操作