我想自动从Git中拉出.由于某些原因,无法在我正在使用的服务器中自动执行密码操作.因此,它需要由Bash文件来完成.现在我的Bash编码不是很好.然后可以输入SSH密钥的密码.但是我真的不知道该怎么办...
I want to automatically pull from Git. For some reasons it is not possible to automate the password thing in the server I am using. So it needs to be done by a Bash file. Now my Bash coding is not that good. Then it is possible to enter the passphrase for the SSH key. But I have really no clue what to do...
#!/bin/bash cd . public_html/auto_deploy/foldername && git fetch --all && git checkout --force "origin/master"
#!/bin/bash cd . public_html/auto_deploy/foldername && git fetch --all && git checkout --force "origin/master"
以上操作无效...然后需要输入密码,我不知道该怎么办...我该怎么办?
The above is not working... And then it needs to enter the passphrase, and I have no idea what to do then... How can I do this?
推荐答案幸运的是,根据核心 Git文档,您可以使用以下命令保存您的凭据供以后使用-而不是每次出现提示时都键入它.
Fortunately and according to the core Git documentation, you can use the following command to save your credentials for later on use - instead of typing it each time when prompted.
git config credential.helper store
使用此帮助程序会将您未加密的密码存储在磁盘上, 仅受文件系统权限保护.此命令将凭据无限期地存储在磁盘上,以供将来的Git程序使用.
Using this helper will store your passwords unencrypted on disk, protected only by filesystem permissions. This command stores credentials indefinitely on disk for use by future Git programs.
您可能不想直接调用此命令;它的意思是 会被git的其他部分用作凭证帮助器
You probably don’t want to invoke this command directly; it is meant to be used as a credential helper by other parts of git
有趣的检查: Git凭证
更多推荐
Bash脚本自动执行Git拉取
发布评论