上传代码到Git远程仓库(Github)

一 在官网https://github.com/注册一个账号。
二 在网站内创建一个仓库,取名叫code。
三 将本地的文件上传到远程仓库。
[root@localhost ~]# pwd
/root
[root@localhost ~]# echo "# code" >>READE.md
[root@localhost ~]# cat READE.md 
# code
[root@localhost ~]# git init
Initialized empty Git repository in /root/.git/
[root@localhost ~]# git add READE.md
[root@localhost ~]# git commit -m "first commit"
[master (root-commit) 81a76a3] first commit
 1 file changed, 1 insertion(+)
 create mode 100644 READE.md
[root@localhost ~]# git remote add origin https://github.com/cakin24/code.git
[root@localhost ~]# git push -u origin master
Username for 'https://github.com': cakin24
Password for 'https://cakin24@github.com': 
Counting objects: 3, done.
Writing objects: 100% (3/3), 211 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/cakin24/code.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
[root@localhost ~]# vim READE.md 
[root@localhost ~]# git add READE.md
[root@localhost ~]# git commit -m "second commit"
[master f7f5350] second commit
 1 file changed, 1 insertion(+)
[root@localhost ~]# git push -u origin master
Username for 'https://github.com': cakin24
Password for 'https://cakin24@github.com': 
Counting objects: 5, done.
Writing objects: 100% (3/3), 246 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/cakin24/code.git
   81a76a3..f7f5350  master -> master
Branch master set up to track remote branch master from origin.
四 验证是否上传成功

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值