【发布时间】:2016-08-09 00:44:30
【问题描述】:
我想和伙伴一起开发一个项目。该项目在我的存储库中。如果我的伙伴可以在没有我的许可和代码审查的情况下直接使用他们自己的帐户将他们的代码提交到我的存储库?如何实现这一点?我需要一些细节。非常感谢。
【问题讨论】:
-
将他们添加为 repo 上的协作者(在“设置”选项卡中)。
标签: git git-push git-commit
我想和伙伴一起开发一个项目。该项目在我的存储库中。如果我的伙伴可以在没有我的许可和代码审查的情况下直接使用他们自己的帐户将他们的代码提交到我的存储库?如何实现这一点?我需要一些细节。非常感谢。
【问题讨论】:
标签: git git-push git-commit
最好的方法是为每个帐户添加多个 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
【讨论】: