繁体   English   中英

GitHub git remote add origin git@github.com:username / ProjectName一次性进程?

[英]GitHub git remote add origin git@github.com:username/ProjectName a one time process?

如果我的机器上有两个git项目,有两个不同的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”而不是origin,并在此周围建立命令别名,以使生活更轻松(即-git git config --global alias.pg=push github master )。 还有一个github ruby​​ gem,它提供了使用github的快捷方式。

remote_location是远程仓库的url或scp路径。 Repos使用ssh,包括私有github repos,以user@host:path/to/repo.git的形式使用scp路径。 Github将其抽象为git@github:username/repo.git 只读repos使用http并且是git repo http://host/path/to/repo.git简单URL。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM