Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does gitlab submit a local project to a remote README-only repository

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to submit a local project to a remote README-only warehouse". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how gitlab submits a local project to a remote README-only warehouse".

Environment: GitLab Community Edition 11.6.1

1. Preface

When we develop a project, we often create a project locally, such as a Spring Boot project. When the project can be started normally, then upload it to the gitlab project. At this time, we have a project on gitlab, but only contains the README.md file, we need to upload the local project to gitlab.

two。 Initialize git

We initialize the git in the directory where the project is located:

Git init3. Local git adds remote warehouse address git remote add origin remote warehouse address 4. Git branch associated with local warehouse and remote warehouse-- set-upstream-to=origin/master master

At this point, an error appears:

Fatal: branch 'master' does not exist

Resolving this issue requires the following:

Git pull origin master-- allow-unrelated-histories5. Reject error occurred when local change was pushed to remote warehouse

If a reject error occurs in git push:

Push rejected: Push master to origin/master was rejected by remote

It should be that the current user operated the protected branch master. This problem is generally caused by the fact that the current user does not have permission. You can create a new develop branch in gitlab, and then check out a develop branch locally, and then merge the changes on the local master to the develop branch and then submit it.

6. Summary

To sum up, if you can work directly on the master branch, the process is as follows:

Git initgit remote add origin http://192.168.32.95/hengbao/happy.gitgit pull origin master-allow-unrelated-historiesgit branch-set-upstream-to=origin/master mastergit checkout developgit add .git commit-m "init project" git push

If your project has a .git directory before it, you need to delete it first.

Postscript

If there is still a problem, please copy the non-variable portion of the error message to the search box in stackoverflow to search: stackoverflow

The reference articles in this article are:

Idea direct push display Push master to origin/master was rejected by remote,git command push You are not allowed to push co

Solve "requested upstream branch 'origin/master' does not exist"

At this point, I believe you have a deeper understanding of "how gitlab submits a local project to a remote warehouse that contains only README". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report