GitHub设置ssh免用户名和密码push

in mini.topia4 years ago

GitHub设置ssh免用户名和密码push

从github上 clone项目后,想提交修改,需要具有提交权限。

但在自己的fork项目上,添加ssh认证后,发现push还要输入用户名和密码。

原来clone的时候,使用的是https,而不是ssh。

$ cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/userxxx/projectyyy
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

需要更新一下origin为ssh方式。

$ git remote remove origin
$ git remote add origin [email protected]:userxxx/projectyyy.git
$ cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[branch "master"]
[remote "origin"]
    url = [email protected]:userxxx/projectyyy.git
    fetch = +refs/heads/*:refs/remotes/origin/*

重新设置track branch

$ git pull origin master
$ git branch --set-upstream-to=origin/master master

再重新提交
git push origin master

Sort:  

He said, 'Stop doing wrong things and turn back to God! The kingdom of heaven is almost here.'(Matthew 3:2)

Bro. Eli Challenges Atheism Belief, There is No God

Watch the Video below to know the Answer...
(Sorry for sending this comment. We are not looking for our self profit, our intentions is to preach the words of God in any means possible.)


Comment what you understand of our Youtube Video to receive our full votes. We have 30,000 #SteemPower. It's our little way to Thank you, our beloved friend.
Check our Discord Chat
Join our Official Community: https://steemit.com/created/hive-182074

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 60782.50
ETH 3371.45
USDT 1.00
SBD 2.51