zoukankan      html  css  js  c++  java
  • 提交改动到 github 远程服务器,怎么跳过要求输入密码的步骤

    新机器上将工程改动提交到 github 服务器时,发现每次都要输入密码,这个有点儿小烦人,怎么解决这个问题呢?

    首先,切换到工程根目录的 .git 隐藏目录,用 TextEdit 打开 config 文件,改成如下的形式:

    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    	ignorecase = true
    [remote "origin"]
    	url = git@github.com:user_name/project_name
    	fetch = +refs/heads/*:refs/remotes/origin/*
    [branch "master"]
    	remote = origin
    	merge = refs/heads/master
    

    一般情况下只需要改动 [remote "origin"].url 这条,

    https://github.com/user_name/project_name.git 改成 git@github.com:user_name/project_name

    然后,按照 Generating SSH Keys 所阐述的流程走一遍

    (生成 ssh 公钥私钥文件,将公钥数据保存到自己的 github 主页设置中)

    这里有一个问题要注意:

    如果自己有多个 github 账号同时在使用,且 ~/.ssh 目录中包含了多个密钥文件,

    已存在的密钥文件可能对新生成的密钥文件造成影响,直观表现就是身份验证出错:

    你是以 A 的身份提交改动却被误判身份为 B,结果导致提交失败。

    另外,如果按照上述的流程完整的走了一遍后还是提示身份验证出错,可以在重启机器后再做尝试。


    参考资料:

    How to save your git password in the Mac OSX keychain

    原文内容:

    Are you tired of constantly having to enter your Git password all the time? 

    Here’s how to make life much easier for you by saving the git password in the Mac OSX keychain.

    In order to not having enter your git based password every time you perform a git operation, 

    here’s how you can store the git password in the Mac OSX keychain:

    Check if you have the credential-osxkeychain helper already installed:

    git credential-osxkeychain

    If not, the download and install it:

    curl http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain -o git-credential-osxkeychain

    sudo mv git-credential-osxkeychain /usr/local/bin

    sudo chmod u+x /usr/local/bin/git-credential-osxkeychain

    And make git use the helper:

    git config --global credential.helper osxkeychain

  • 相关阅读:
    RobotFrameWork(一)robotfamework(python版)及Ride在windows安装
    Sql日期时间格式转换[zhuan]
    SQL query
    WPF窗体视图中绑定Resources文件中字符串时,抛出:System.Windows.Markup.StaticExtension
    Power Map 更新日志
    球面墨卡托(Spherical Mercator)
    TPL(Task Parallel Library)多线程、并发功能
    WPF:保存窗口当前状态截图方法
    dynamic关键字
    Error: Cannot Determine the location of the VS common tools folder
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3241588.html
Copyright © 2011-2022 走看看