如何使用命令行在Gitlab中创建本地仓库和远程仓库?

8
我已经创建了一个项目,我想把它存储在Gitlab中。如何使用命令行在Gitlab中创建本地仓库和远程仓库?我希望同时创建本地仓库和远程仓库。
我找到了解决方案。
以下是使用Gitlab创建本地仓库和远程仓库的步骤:
1. 运行 `git init` 命令(创建本地仓库)。 2. 运行 `git add .` 命令。 3. 运行 `git commit -m "message"` 命令。 4. 使用SSH进行Git push(创建远程仓库):
`git push --set-upstream git@gitlab.example.com:your-username/nonexistent-project.git master` 5. 使用HTTP进行Git push。
git push --set-upstream https://gitlab.example.com/your-username/nonexistent-project.git master

2
这可能会有所帮助:https://dev59.com/AFwY5IYBdhLWcg3wCD-W#42311714 - Arghya Saha
@PraveenP 我正在寻找创建本地仓库和远程仓库的方法。上面的问题只回答了创建远程仓库的问题。所以这不是一个重复问题,而且我已经在我的问题中提到了我得到了解决方案。 - Gobind
1个回答

14

使用Gitlab创建本地仓库和远程仓库的步骤。

  1. git init(创建本地仓库)
  2. git add .
  3. git commit -m "message"
  4. 使用SSH进行Git推送(创建远程仓库):

    git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
    

    使用HTTP进行Git push:

    git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
    

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接