linux 设置git与github账户连接

参考:

https://github.com/google/earthenterprise/wiki/Development:-Git-Contributions

https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

在linux中,通过ssh-agent方式连接到github,使用自己的账户fork的Repository
以gee为例子。


ssh-keygen -t ed25519 -C "[email protected]"

/root/.ssh/id_ed25519      // id_ed25519可以自己设置

提示设置password:
eval "$(ssh-agent -s)"
提示:Agent pid 9360

ssh-add ~/.ssh/id_ed25519
提示:
Enter passphrase for /root/.ssh/id_ed25519: 
Identity added: /root/.ssh/id_ed25519 ([email protected])
cat .ssh/id_ed25519.pub
拷贝:打印出来的内容

Adding a new SSH key to your GitHub account
在浏览器中,打开github--account--settings--SSH and GPG keys---SSHE
把上面拷贝的内容黏贴进去
title自己填写

https://github.com/google/earthenterprise 页面点击 fork,在自己的账户形成一个fork版本

即:https://github.com/aganliang/earthenterprise

git clone [email protected]:aganliang/earthenterprise.git
提示:
正克隆到 'earthenterprise'...
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThb****xdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:27:ac:a5:******4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
remote: Enumerating objects: 14655, done.
remote: Total 14655 (delta 0), reused 0 (delta 0), pack-reused 14655
接收对象中: 100% (14655/14655), 329.39 MiB | 6.95 MiB/s, 完成.
处理 delta 中: 100% (7102/7102), 完成.
正在更新文件: 100% (9739/9739), 完成.
过滤内容: 100% (48/48), 461.69 MiB | 4.95 MiB/s, 完成.

// move into the repository directory  
cd earthenterprise  
// set the upstream  
git remote add upstream git://github.com/google/earthenterprise.git


使用方法:

git checkout master
git fetch upstream
git pull upstream master
git push
git fetch upstream --tags
git push --tags

猜你喜欢

转载自blog.csdn.net/aganliang/article/details/110662784
今日推荐