在clone项目的时候,手快选择了https的方式,导致每次提交,或者拉取代码的时候都要重新输入用户名,密码相当的不方便,其实可以通过修改.git目录下面的config文件来修改。

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    url = https://xxxxxxxxx.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "dev"]
    remote = origin
    merge = refs/heads/dev

上面是config文件的内如,只需要修改url的链接地址就可以了。

[remote "origin"]
    url = https://xxxxxxxx.git
    fetch = +refs/heads/*:refs/remotes/origin/*

将上面的修改为

[remote "origin"]
    url = git@git.xxxxxx.git
    fetch = +refs/heads/*:refs/remotes/origin/*