github仓库管理(Linux 命令行)

框架

 

一、安装git工具

sudo  apt-get install git

二、配置git

1、设置ssh密钥

ssh-keygen -t rsa -C "github邮箱"

Generating public/private rsa key pair.
Enter file in which to save the key (/home/xxx/.ssh/id_rsa):
Created directory '/home/xxx/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xxx/.ssh/id_rsa
Your public key has been saved in /home/xxx/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ckBJoq6qi4croYkik+T//wuYLVlurXiairNS1dWzc1E liutt1312@126.com
The key's randomart image is:
+---[RSA 3072]----+
|    ..o. .   .E  |
|   . o. . o .    |
|  .  ...   o .   |
| .  . ..  o .    |
|  ..  ..S  o     |
|.o.   Bo.        |
|**   = = .       |
|#oo   =.o        |
|%B+oo=+o.o.      |
+----[SHA256]-----+

2、将.ssh/id_rsa.pub 文件内容拷贝,添加至github

头像->settings->SSH and GPG keys ->new SSH key

3、配置github用户名和邮箱

git config --global user.name "用户名"

git config --global user.email 邮箱

三、配置、提交本地项目(工程)

1、初始化
git init

2、在github创建仓库,添加远程访问
git remote add origin git@github.com:github用户名/test.git
git remote set-url origin git@github.com:github用户名/test.git

3、提交文件至本地暂存区(.git/index)
git add filename    (git add ./)

4、提交暂存区文件至本地仓库(.git/)
git commit -m "提交信息"

5、上传本地仓库
git push -u origin master

四、克隆项目

克隆整个项目
git clone git@github.com:用户名/test.git

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值