[入门操作]:git 的一些小操作

git中文版

1. git push 输入密码

  1. 利用git-credentials
    touch .git-credentials
    vim .git-credentials
    https://{username}:{password}@github.com
    
  2. ssh密钥
    ssh-keygen -t rsa -C "youremail"
    
    然后将~/.ssh/id_rsa,pub复制到github中。

2. .gitignore一些规则

# 忽略 .a 文件
*.a
# 但否定忽略 lib.a, 尽管已经在前面忽略了 .a 文件
!lib.a
# 仅在当前目录下忽略 TODO 文件, 但不包括子目录下的 subdir/TODO
/TODO
# 忽略 build/ 文件夹下的所有文件
build/
# 忽略 doc/notes.txt, 不包括 doc/server/arch.txt
doc/*.txt
# 忽略所有的 .pdf 文件 在 doc/ directory 下的
doc/**/*.pdf

3. 修改远程仓库地址

```
git remote rm origin
git remote add origin [url]
```

4. 设置代理

1、使用命令
http代理:

git config --global https.proxy http://127.0.0.1:10800
git config --global https.proxy https://127.0.0.1:10800

socks5代理:

git config --global http.proxy 'socks5://127.0.0.1:10800'
git config --global https.proxy 'socks5://127.0.0.1:10800'

2、编辑文件~/.gitconfig
在文件添加:

[http]
proxy = socks5://127.0.0.1:10800
[https]
proxy = socks5://127.0.0.1:10800

然后就可以直接使用git命令重新下载了。
取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值