学习git第二天

注:来源https://www.liaoxuefeng.com/

 

将本地文件上传至github

1.首先将文件上传至本地仓库(add+commit)后,生成ssh密钥

$ ssh-keygen -t rsa -C "1477374613@qq.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/shazx/.ssh/id_rsa):    //enter,密钥文件就在.ssh下面,也就是.hub的内容
Created directory '/c/Users/shazx/.ssh'.
Enter passphrase (empty for no passphrase):   //enter
Enter same passphrase again:    //enter
Your identification has been saved in /c/Users/shazx/.ssh/id_rsa.
Your public key has been saved in /c/Users/shazx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ovAE1zwT25sZszRjtRAvdwHb6X7pE5oVPuTGQUw4qE8 1477374613@qq.com
The key's randomart image is:
+---[RSA 2048]----+
|      . o.oo.+.  |
|     o + +.+ooo  |
|  . . * X.= +o   |
|   o   =.%Eo  +  |
|  . . . So  .= o |
|   + . .  ..  O. |
|    o       .=oo |
|            oo.  |
|              .. |
+----[SHA256]-----+

  2 点击头像新建ssh密钥,将pub中的密钥复制上去

  3 首先是添加新的远程仓库

$ git remote add origin  https://github.com/zxjwd/tc.git  //后面的地址为SSH的https

  然后对远程仓库提交

$ git push origin master
fatal: HttpRequestException encountered.
   ▒▒▒▒▒▒▒▒ʱ▒▒▒▒
Username for 'https://github.com': zx
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (9/9), 759 bytes | 151.00 KiB/s, done.
Total 9 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/zxjwd/tc.git
 * [new branch]      master -> master

 通过SSH clone项目

  新建一个空的文件夹,使用 Git bash

  找到所需项目,点击clone会有ssh

$ git clone git@github.com:FreeApophis/TrueCrypt.git   后面就是项目的ssh地址   
Cloning into 'TrueCrypt'...
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
remote: Enumerating objects: 5129, done.
Receiving objects:  20% (1050/5129), 4.76 MiB | 25.00 KiB/s

  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值