git学习笔记1

git学习笔记1

  • 安装
  • 设置SSH
  • 测试SSH
  • clone github仓库
  • 设置本地编辑器命令
  • 同步内容到仓库

安装

设置SSH

$ ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key
(/Users/your_user_directory/.ssh/id_rsa): **按回车键**
Enter passphrase (empty for no passphrase): **输入密码**
Enter same passphrase again: **再次输入密码**

将用户目录下**/.ssh/id_rsa.pub**的密钥复制到github的ssh管理里面

测试SSH

$ ssh -T [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is fingerprint值 .
Are you sure you want to continue connecting (yes/no)? 输入yes 

显示

Hi hirocastest! You've successfully authenticated, but GitHub does not 
provide shell access

说明成功,有的需要输入先前设置的密码

clone github仓库

先在github创建一个
再将ssh链接复制下来

 git clone 这里是你复制的ssh
 比如我的
  git clone [email protected]:(账户名)/仓库名.git
cd 仓库名

进入目录

设置本地编辑器命令

在桌面新建一个文件
文件名是你希望调用编辑器的命令名
比如我用sublime text,我的文件名sublime,不需要后缀
里面编辑上如下内容

#!/bin/sh
"H:\Sublime Text4\sublime_text.exe" $1 &

路径替换为你编辑器的路径
保存将它放在你git安装目录下

".\Git\mingw64\bin\"

然后调用命令如下

sublime hello.cpp

就会自动调用

同步内容到仓库

更新完文件后

 git add hello.cpp

添加你的更新文件

git commit -m "这是备注"

提交

git push

更新仓库
结束后仓库将更新

你可能感兴趣的:(git学习记录,git,学习,github,1024程序员节)