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

标签 git gitlab

我创建了一个项目。我想将我的项目存储在 Gitlab 中。如何使用命令行在Gitlab中创建本地仓库和远程仓库? 我正在寻找创建本地存储库和远程存储库的创建。

我得到了解决方案。 使用 Gitlab 创建本地存储库和远程存储库的步骤。

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

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

使用 HTTP 的 Git 推送:

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

最佳答案

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

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

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

    使用 HTTP 推送:

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

关于git - 如何使用命令行在Gitlab中创建本地仓库和远程仓库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51811227/

相关文章:

go - 获取 gitlab repo 列表 : says "401 Unauthorized"

gitlab - IP上的Omnibus GitLab,不带域名,并且具有自定义的relative_url_root

git - 当 git 子模块引用的 repo 被删除时会发生什么?

git - 无法推送或 pull 到 Github

docker - 如何在 gitlab-ci.yml 中将文件从存储库复制到用于作业的 Docker 容器中

scala - 无法更新项目 '120' : HTTP 403 Forbidden 的 Gitlab 提交状态

nginx - 自托管 Gitlab 服务器无法访问

linux - SonarQube 可以配置为在 linux 机器上使用 windows 行结尾吗?

xcode - Xcode 如何与 Git 一起使用来更改分支和 check out 旧提交?

git - Git的SSH兼容性问题