GitHub的远程Git添加起源git@github.com:用户名/项目名一次性的过程吗?

StackOverflow https://stackoverflow.com/questions/1833258

  •  11-09-2019
  •  | 
  •  

如果我有我的机器上有两个混帐项目 用两种不同的ProjectNames

我可以与此代码在两个目录这样管理它

/foo1$ git remote add origin git@github.com:username/ProjectName-1
/foo2$ git remote add origin git@github.com:username/ProjectName-2

时它得到存储在目录中,或在系统中的GIT中的配置文件

有帮助吗?

解决方案

的信息被存储在每个存储库(项目)中,在.git/config文件。

您由远程分别添加到每个库做正确的事。

其他提示

当然可以。当您创建GitHub上的新资料库,能够显示帮助屏幕如何检出新项目或如何添加GitHub的远程:

cd existing_git_repo
git remote add origin git@github.com:username/test.git
git push origin master

遥控器只存储在本地,你可以随时更改。

git remote add remote_name remote_location

REMOTE_NAME通常为原点在大多数的例子。如果你有一个以上的遥控器,那么你将使用不同的名称。对于github上我通常使用“github上”,而不是原产地和周围有此内置命令别名,使生活更轻松(即 - git config --global alias.pg=push github master)。还有一个github上红宝石宝石提供快捷方式使用github上。

remote_location是url或SCP路径到远程回购。回购使用ssh,包括私人github上回购在user@host:path/to/repo.git的形式使用scp路径。 Github上这个抽象出来git@github:username/repo.git。只读回购使用http和简单的URL到GIT回购http://host/path/to/repo.git

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top