centos学习笔记--github初步使用部分
2016-12-28 22:04
411 查看
安装git【配置获取rsa-key,使本机上可以使用github】
0.github的使用,需要在添加本机地rsa-key。
1.生成rsa key:ssh-keygen -t rsa -b 4096 -C "XXXXX@yeah.net"
出现: Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
50:9d:e5:6e:a5:7f:19:52:2a:0e:55:2e:5a:ab:fc:6f XXXXX@yeah.net
The key's randomart image is:
+--[ RSA 4096]----+
| .. o.. |
| . o.o |
| . +.... |
| . +.ooo |
| So o+o . |
| . +.... o|
| o . ...|
| . E . |
| .o. |
+-----------------+
2.ssh代理设置:eval "$(ssh-agent -s)"
出现: Agent pid 3103
3.将ssh代理地rsa-key添加到github帐号中:cat /root/.ssh/id_rsa.pub
出现: ssh-rsa XXXXXXXXXXXXXXXXXXXX字符串XXXXXXXXXX= XXXXX@yeah.net
将上面那串字符添加到ssh and gpg keys中
4.测试:ssh -T git@github.com
出现:Enter passphrase for key '/root/.ssh/id_rsa':
Hi XXXXX! You've successfully authenticated, but GitHub does not provide shell access.
表示成功了。
github操作【初始化git配置——创建仓库——添加/删除文件——提交更新——查看日志】
0.配置本地的git账户和邮箱:
[root@localhost github]# git config --global user.name "XXXXX"
[root@localhost github]# git config --global user.email "XXXXX@yeah.net"
1.在git网站自己的账户上创建repository(点点点)
2.创建本地库:
[root@localhost github]# git init
Initialized empty Git repository in /home/luopan/Documents/github/.git/
3.将本地库和网站库关联:
[root@localhost github]# git remote add origin git@github.com:XXXXX/image
4.将文件添加到在本地库:
[root@localhost github]# git add piccs/
5.添加文件注释并提交:
[root@localhost github]# git commit -m XXX文件注释
6.将文件从本地库提交到网站库:
[root@localhost github]# git push
第一回提交到网站库时需要指定branch名:git push --set-upstream origin master
7.上传成功
其他命令:
0.git diff:查看在本地库中修改了什么。修改后还是add->commit->push来进行提交操作
1.git clone git@github.com:XXXXX.git/image.git:下载到本地
2.git log:操作记录
3.git branch:查看分支
4.git checkout -b SSSS:创建新分支
5.git checkout master:切换到master分支
6.git rm 移除文件
0.github的使用,需要在添加本机地rsa-key。
1.生成rsa key:ssh-keygen -t rsa -b 4096 -C "XXXXX@yeah.net"
出现: Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
50:9d:e5:6e:a5:7f:19:52:2a:0e:55:2e:5a:ab:fc:6f XXXXX@yeah.net
The key's randomart image is:
+--[ RSA 4096]----+
| .. o.. |
| . o.o |
| . +.... |
| . +.ooo |
| So o+o . |
| . +.... o|
| o . ...|
| . E . |
| .o. |
+-----------------+
2.ssh代理设置:eval "$(ssh-agent -s)"
出现: Agent pid 3103
3.将ssh代理地rsa-key添加到github帐号中:cat /root/.ssh/id_rsa.pub
出现: ssh-rsa XXXXXXXXXXXXXXXXXXXX字符串XXXXXXXXXX= XXXXX@yeah.net
将上面那串字符添加到ssh and gpg keys中
4.测试:ssh -T git@github.com
出现:Enter passphrase for key '/root/.ssh/id_rsa':
Hi XXXXX! You've successfully authenticated, but GitHub does not provide shell access.
表示成功了。
github操作【初始化git配置——创建仓库——添加/删除文件——提交更新——查看日志】
0.配置本地的git账户和邮箱:
[root@localhost github]# git config --global user.name "XXXXX"
[root@localhost github]# git config --global user.email "XXXXX@yeah.net"
1.在git网站自己的账户上创建repository(点点点)
2.创建本地库:
[root@localhost github]# git init
Initialized empty Git repository in /home/luopan/Documents/github/.git/
3.将本地库和网站库关联:
[root@localhost github]# git remote add origin git@github.com:XXXXX/image
4.将文件添加到在本地库:
[root@localhost github]# git add piccs/
5.添加文件注释并提交:
[root@localhost github]# git commit -m XXX文件注释
6.将文件从本地库提交到网站库:
[root@localhost github]# git push
第一回提交到网站库时需要指定branch名:git push --set-upstream origin master
7.上传成功
其他命令:
0.git diff:查看在本地库中修改了什么。修改后还是add->commit->push来进行提交操作
1.git clone git@github.com:XXXXX.git/image.git:下载到本地
2.git log:操作记录
3.git branch:查看分支
4.git checkout -b SSSS:创建新分支
5.git checkout master:切换到master分支
6.git rm 移除文件
相关文章推荐
- Memcached学习笔记——windows上初步使用(与php结合)
- Memcached学习笔记——windows上初步使用(与java结合)
- Linux学习笔记之RedHat Enterprise Linux 6.4 使用 Centos 6 的yum源问题
- Github使用学习笔记(二)
- MongoDB 学习笔记一 CentOS下安装、使用、性能监测
- github快速使用指南—git学习笔记
- Linux 学习笔记 -- 第四部分 Linux 使用着管理 -- 第18章 认识系统服务
- iOS学习笔记1--在xcode6以上的版本中不使用storyboard以及部分控件使用
- Github使用学习笔记
- Github使用学习笔记(一)
- Memcached学习笔记——windows上初步使用(与java结合)
- Linux 学习笔记 -- 第四部分 Linux 使用着管理 -- 第15章 磁盘配额 (Quota) 与高级文件系统管理
- php学习笔记(三十四)smarty框架的初步使用和注意事项
- 学习笔记-gitHub使用
- Memcached学习笔记——windows上初步使用
- php学习笔记(二十二)PDO的安装和初步使用
- github快速使用指南—git学习笔记
- Cocos2dx 3.1.1 学习笔记整理(4):事件监听与Action的初步使用
- PostgreSql 学习笔记一 CentOS下安装使用 及常用命令
- GitHub学习笔记—客户端的使用