文章目录
配置文件存放三个位置
项目配置文件:项目/.git/config
git config --local user.name ‘xxx’
git config --local user.email ‘xxx@xx.com’
全局配置文件:~/.gitconfig
git config --global user.name ‘xxx’
git config --global user.name 'xxx@xx.com
系统配置文件:/etc/.gitconfig
git config --system user.name ‘xxx’
git config --system user.name ‘xxx@xx.com’
注意:需要有root权限
免密码登录
GitHub
URL中体现
原来的地址:https://github.com/xxx/dbhot.git
修改的地址:https://用户名:密码@github.com/xxx/dbhot.git
git remote add origin https://用户名:密码@github.com/xxx/dbhot.git
git push origin master
SSH实现
1.生成公钥和私钥(默认放在~/.ssh目录下,id_rsa.pub公钥、id_rsa私钥) ssh-keygen
2.拷贝公钥的内容,并设置到github中。
3.在git本地中配置ssh地址
git remote add origin git@github.com:juran/dbhot.git
4.以后使用
git push origin master
git忽略文件
让Git不再管理当前目录下的某些文件。
*.h
!a.h
files/
*.py[c|a|d]
码云
码云创建ssh公钥
ssh-keygen -t rsa -C “xxxxx@xxxxx.com” # 将邮箱替换成码云注册邮箱。
回车三次即可生成sshkey
查看 public key,并把他添加到码云(Gitee.com) cat ~/.ssh/id_rsa.pub # 将ssh-rsa到邮箱部分的内容复制出来
添加用户sshkey
通过个人》设置,添加ssh公钥
在terminal中继续执行
ssh -T git@git.oschina.net
返回Welcome to Git@OSC, yourname!表示添加成功。
变更为ssh协议认证
将https协议认证变成ssh协议认证
git remote rm origin # 将远程的提交方式删除,然后添加新的提交方式 git remote add origin git@github.com:xxx/xxx.git
更多参考:https://github.com/github/gitignore
github任务管理相关
- issues,文档以及任务管理。
- wiki,项目文档。