Git免密传输完整步骤

#. Git免密传输完整步骤


##前期准备
###注册GitHub:略
###设置用户
git config --global user.name “your name”
git config --globa user.email “your email.com”

###创建目录
mkdir new_folder_name
创建一个用于跟踪的新文件夹或者使用系统自带的文件管理系统创建一个新的文件夹
在创建目录中操作
在new_folder_name 文件夹中执行 git init
在new_folder_name 文件夹中 创建README.md(必须)和其他文件
在new_folder_name 文件夹中执行 git add [filename]命令–添加到缓存
在new_folder_name 文件夹中执行 git commit 命令 —提交到本地仓库
添加远程主机到仓库 git remote add origin git@github.com:samtfg/Repository_hello.git
将本地分支推送给远程仓库 git push -u origin master

##第一步:在前期准备基础上:在/home/python/.ssh/下生成:id_rsa id_rsa.pub :ssh 公钥私钥
1、在new_folder_name中
输入ssh-keygen -t rsa -b 4096 -C "your_email@example.com"命令,将 your_email@example.com 替换为你的邮箱
2、当你看到 “Enter a file in which to save the key,” 的提示后,按Enter键.意思就是使用默认路径
3、看到, type a secure passphrase.的提示后,输入你的密码
4、此时在/home/python/.ssh/下生成:id_rsa id_rsa.pub :ssh 公钥私钥对
5、提取公钥:python@ubuntu:~/.ssh$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC334M+7AglK1QZftdmmyCIxHm2mz************************
6、复制id_pub内容到github账户

##第二步:建立项目的ssh克隆
python@ubuntu:~/new_folder_name$ git clone git@github.com:your GitHubname/yourdepository.git
正克隆到 ‘yourdepository’…
The authenticity of host ‘github.com (13.229.188.59)’ can’t be established.
RSA key fingerprint is SHA256:n*************
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,13.229.188.59’ (RSA) to the list of known hosts.
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0
接收对象中: 100% (3/3), 完成.
检查连接… 完成。

##所有步骤操作完成后,配置项如下:
python@ubuntu:~/new_folder_name$ git config --list
user.email=youremail
user.name=yourGitHubname
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.urlgit@github.com:yourGitHubname/yourdepository.git
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
branch.master.remote=origin
branch.master.merge=refs/heads/master

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值