git - 如何在gitlab中将http设置为项目默认url

标签 git gitlab

在gitlab中打开一个项目时,你会在项目主页的顶部看到SSH和HTTP(或HTTPS)url,SSH url是默认的,但我想将HTTP(或HTTPS)设置为默认,所以我应该怎么做?谢谢

最佳答案

事实上,您必须修改 default_clone_protocol 上面的另外 2 行。

def default_url_to_repo(project = nil)
  project = project || @project
  current_user ? project.http_url_to_repo : project.url_to_repo
end

def default_clone_protocol
  current_user ? "http" : "ssh"
end

关于git - 如何在gitlab中将http设置为项目默认url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21203344/

相关文章:

reactjs - Gitlab 页面和 React Router

ubuntu - 在标准 gitlab 安装上运行另一个网站

git - 我不小心在 master 上工作,如何将我对分支重置 master 所做的所有更改转移到最后一次提交?

git - 如何在 Capistrano 的 deploy.rb 中指明 Git 用户名和密码?

intellij-idea - 如何将项目从 IDEA 连接到 Gitlab

java - Jenkins:如果我们在两个不同的 GitLab 存储库中有代码,我们可以做 'continuous integration' 吗?

linux - 如何计算gitlab中两次提交之间更改的行数?

git - 如何从 git branch 构建 Carthage 框架

git - 部署 ASP.Net MVC .Net Core 应用程序时出现错误 MSB4025

GitHub 不允许我访问子文件夹