git push 免密码


git push 免密码

通用情况

1.使用文件创建用户名和密码

文件创建在用户主目录下:

touch .git-credentials
vim .git-credentials
https://{username}:{password}@github.com

记得在真正输入的时候是没有大括号的。

2.添加git config内容

git config --global credential.helper store

执行此命令后,用户主目录下的.gitconfig文件会多了一项:[credential]

helper = store

重新git push就不需要用户名密码了。

使用ssh协议

首先生成密钥对:

ssh-keygen -t rsa -C "youremail"

接下来按照提示操作,默认可以一路往下。

然后将生成的位于~/.ssh/id_rsa.pub的内容复制到你github setting里的ssh key中。

复制之后,如果你还没有克隆你的仓库,那你直接使用ssh协议用法:git@github.com:yourusername/yourrepositoryname克隆就行了。

如果已经使用https协议克隆了,那么按照如下方法更改协议: git remote set-url origin git@github.com:yourusername/yourrepositoryname.git

Done!


git add 使用tab键自动补全的中文文件名乱码

文件名乱码如下所示:

乱码

解决方法为:

git config --global core.quotepath false

效果如下:

效果

可以看出中文已经正确显示了。


jupyter notebook 创建密码

产生jupyter notebook的配置文件:

jupyter notebook --generate-config

生成的配置文件位置为:~/.jupyter/jupyter_notebook_config.py

打开jupyter,新建一个notebook,创建密码以及生成密码的sha1密钥,所需代码如下:

from notebook.auth import passwd
passwd()

输入一遍你想设置的密码,然后再输入一遍确认,记录下生成的sha1密钥值。形式如:‘sha1:xxxxxxx'

然后将这段值按如下格式粘贴到配置文件中对应的c.NotebookApp.password = u'sha1:xxxx'位置上,如果你不想寻找文件中的这个位置,你也可以在文件末尾新建一个。

重启jupyter,密码生效。

原文地址:https://www.cnblogs.com/m2maomao/p/8290023.html