github创建上传本地项目

安装Git-2.20.1-64-bit.exe,全部Next默认安装(安装路径不包含中文字符避免应用错误)

打开Git Bash 配置用户名、邮箱

git config --global user.name "username"

git config --global user.email "[email protected]"

生成对应的私钥公钥

ssh-keygen -t rsa -C "[email protected]"

第一步为key保存的路径

第二步设置密码,默认为空

第三步再次确认密码

C:\Users\用户\.ssh 生成ssh key 文件id_rsa.pub

拷贝内容到github

在GitHub中Create a new repository如图,命名后就可以创建了

 

此时将代码推送到github上,到代码文件夹中运行git bash执行以下命令

$ git init

$ git add .

$ git commit -m "提交文件"

$ git remote add origin [email protected]:yanglei001/forword.git

yes

当回到github的Repositories中,code中就是提交的代码

使用TortoiseGit提交代码时,SSH client路径设置如下图所示。