Git总结笔记3-把本地仓库推送到github

这世界,不是每个人都有机会做自己想做的事情,但是我们应该尽量去做那些正确的事情。

---小猫咪1997

1

1.配置公钥

[root@kangvcar ~]# ssh-keygen -t rsa -C "kangvcar@126.com"

[root@kangvcar ~]# cat .ssh/id_rsa.pub

注意:在本地用ssh-keygen生成密钥对后,把公钥添加到github上

2

2.安装git服务

[root@kangvcar ~]# yum -y install git

3.配置基本环境参数

[root@kangvcar ~]# git config --global user.name "kangvcar"

[root@kangvcar ~]# git config --global user.email "kangvcar@126.com"

4.创建本地仓库目录并初始化

[root@kangvcar ~]# mkdir kangvcar    [root@kangvcar ~]# cd kangvcar/

[root@kangvcar kangvcar]# git init

[root@kangvcar kangvcar]# echo "ni hao kangvcar" >> test.txt

3

5.将项目的所有文件添加到仓库中,并commit

[root@kangvcar kangvcar]# git add .

[root@kangvcar kangvcar]# git commit -m "add test.txt"

6.到github上创建自己的Repository,名字可以不同

7.进入到新建的Repository,获取项目的地址

如地址:git@github.com:kangvcar/kangvcar.git

8.将本地仓库与远程仓库关联

[root@kangvcar kangvcar]# git remote add origin git@github.com:kangvcar/kangvcar.git

9.将本地仓库推送到github上

[root@kangvcar kangvcar]# git push -u origin master

Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.


Counting objects: 3, done.


Writing objects: 100% (3/3), 222 bytes | 0 bytes/s, done.


Total 3 (delta 0), reused 0 (delta 0)


To git@github.com:kangvcar/kangvcar.git


* [new branch]      master -> master


Branch master set up to track remote branch master from origin.12345678

10.在github上就能看到推送的更新了

版权声明

版权声明:本文为博主原创文章。

同步此链接:

http://blog.csdn.net/kangvcar/article/details/72773839

欢迎指点评论,技术交流

醉翁猫咪

✬如果你喜欢小猫咪1997文章,欢迎分享到朋友圈✬

这世界

不是每个人都有机会做自己想做的事情

但是我们应该尽量去做那些正确的事情

醉翁猫咪  |   小猫咪1997

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值