轻松的Git时间

这里就记录了一些自己常用的Git命令,好记性不如烂笔头~

git-ssh 配置与使用

 git config --global user.name "You Name"
 git config --global user.email yourmail@server.com
 //生成密钥
 ssh-keygen -C 'yourmail@server.com' -t rsa
 ssh-add ~/.ssh/id_rsa

若执行ssh-add /path/to/xxx.pem是出现这个错误:Could not open a connection to your authentication agent,则先执行如下命令即可:

 ssh-agent bash

Are you sure you want to continue connecting (yes/no)? yes

6、修改.git文件夹下config中的url。
修改前

[remote "origin"]
url = https://github.com/humingx/humingx.github.io.git
fetch = +refs/heads/:refs/remotes/origin/

修改后

[remote "origin"]
url = git@github.com:humingx/humingx.github.io.git
fetch = +refs/heads/:refs/remotes/origin/

git 同步

// 远程版本库克隆到本地
git clone https://github.com/tony-green/coolweather.git
// 将所有文件添加到版本控制中
git add .
// 本地执行提交操作
git commit -m "First commit."
//将提交的内容同步到远程版本库
git push origin master
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容