【问题标题】:how to develop the same project in github using the different accounts如何使用不同的帐户在 github 中开发相同的项目
【发布时间】:2016-08-09 00:44:30
【问题描述】:

我想和伙伴一起开发一个项目。该项目在我的存储库中。如果我的伙伴可以在没有我的许可和代码审查的情况下直接使用他们自己的帐户将他们的代码提交到我的存储库?如何实现这一点?我需要一些细节。非常感谢。

【问题讨论】:

  • 将他们添加为 repo 上的协作者(在“设置”选项卡中)。

标签: git git-push git-commit


【解决方案1】:

最好的方法是为每个帐户添加多个 ssh 密钥,然后将它们添加到您的配置文件中。


https://gist.github.com/jexchan/2351996


create different public key

根据文章 Mac Set-Up Git 创建不同的 ssh 密钥

$ ssh-keygen -t rsa -C "your_email@youremail.com"

例如,2 个密钥创建于:

~/.ssh/id_rsa_1
~/.ssh/id_rsa_2

Add these two keys to the ssh-agent:

$ ssh-add ~/.ssh/id_rsa_1
$ ssh-add ~/.ssh/id_rsa_2
you can delete all cached keys before

$ ssh-add -D

check your keys

$ ssh-add -l

Add the keys to the config file:***

#activehacker account
Host github.com-1
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_1

#jexchan account
Host github.com-2
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_1

【讨论】:

    【解决方案2】:

    你看过this吗?您的伙伴可以提议文件更改。那么你所要做的就是接受它们。

    【讨论】:

    • 谢谢,我的意思是如果没有我的同意,队友可以直接在我的存储库中推送代码
    • @user1826 然后尝试this。它允许您将您的朋友添加到组织中。如果可行,请不要忘记按勾选按钮!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-10
    • 1970-01-01
    • 2012-09-18
    • 2013-10-30
    • 2021-10-29
    • 2012-06-13
    • 2023-03-15
    相关资源
    最近更新 更多