======================注册账户以及创建仓库===================
要想使用github第一步当然是注册github账号了, github官网地址:
https://github.com/。 之后就可以创建仓库了(免费用户只能建公
共仓库),Create a New Repository,填好名称后Create,之后会
出现一些仓库的配置信息,这也是一个git的简单教程。
Github 安装
下载 git OSX 版
下载 git Windows 版
下载 git Linux 版
配置Git
首先在本地创建ssh key;
$ ssh-keygen -t rsa -C "your_email@youremail.com"
后面的your_email@youremail.com改为你在github上注册的邮箱,之
后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成
功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面
的key。回到github上,进入 Account Settings(账户配置),左边
选择SSH Keys,Add SSH Key,title随便填,粘贴在你电脑上生成的key。
=======================================
在linux上创建用户及邮箱192.168.44.100
[root@localhost ~]$ git config --global user.name "your name"
[root@localhost ~]$ git config --global user.email "your_email@youremail.com"
[root@localhost ~]# git clone git@github.com:guoqingyangzz/repotest.git
Cloning into 'repotest'...
Warning: Permanently added the RSA host key for IP address
'52.74.223.119' to the list of known hosts.
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
[root@localhost ~]# cd repotest
[root@localhost repotest]# ls
README.md
[root@localhost repotest]# touch index.html
[root@localhost repotest]# echo "this is git test" > index.html
[root@localhost repotest]# git add index.html
[root@localhost repotest]# git commit -m "frist test" index.html
[master 2efcf80] frist test
1 file changed, 1 insertion(+)
create mode 100644 index.html
[root@localhost repotest]# git push origin master
Warning: Permanently added the RSA host key for IP address
'13.250.177.223' to the list of known hosts.
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 286 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:guoqingyangzz/repotest.git
e149849..2efcf80 master -> master
登陆github查看提交内容
网友评论