代码拉取完成,页面将自动刷新
$ git clone git@github.com:mxthin/video.git
$ git init
$ git add .
$ git commit -m "更新内容"
$ git push -u origin master
输入用户名和密码
上传成功
$ git remote add origin git@github.com:mxthin/video.git
略去,请自行Google,啥?要翻墙,那你百度吧 本文以github、win10环境作为演示
打开github.com注册并登陆
点击右上角,在弹出菜单中选“Settings”,然后在新的页面中点击“SSH and GPG keys”,这时候你会看到有一个标着key的文本框等你填充,啥?你的没有,没有你点右上角的 “New SSH key” 按钮就有了
然后……页面不要关闭,等待指令
下载git并安装:https://git-for-windows.github.io/
安装完毕后,打开Git Bash,输入 git,出现如下代码说明安装成功。
$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
接下来 ,输入命令 ssh ,显示如图怎么ssh存在
m@ofpt MINGW64 ~
$ ssh
usage: ssh [-1246AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L address] [-l login_name] [-m mac_spec]
[-O ctl_cmd] [-o option] [-p port]
[-Q cipher | cipher-auth | mac | kex | key]
[-R address] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]
那么来生成ssh key,输入命令 ssh-keygen -t rsa ,然后按三次回车即可,生成的key的位置在你输入命令之后会显示出来。比如我的就在c/Users/m/.ssh/目录下
m@ofpt MINGW64 ~
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/m/.ssh/id_rsa):
这时候我们打开该目录,找到 id_rsa.pub,这是公钥,打开后复制里面的内容,然后回到第二小节里面打开的页面,把公钥内容黏贴到文本框内,title可以不填写,然后点击 Add SSH key 按钮提交。
我们回到 Git Bash,输入ssh -T git@github.com 如果出现
m@ofpt MINGW64 ~
$ ssh -T git@github.com
Hi your-github-name! You've successfully authenticated, but GitHub does not provide shell access.
说明公钥添加成功,联通正常
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。