In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces the knowledge of "how to submit code to Github and QYun Gitee at the same time". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The contents of this article:
1. Use of multiple remote warehouses
Multiple remote repositories are rarely used in projects, but Git itself is supported.
So let's review the Git command with a case: the case code is already hosted in Github, and now we need to add a Gitee remote repository.
1.1 View remote warehouse
Let's take a look at the remote warehouse of the current project.
Git remote
No surprise, it should output:
Origin
This origin is a name that points to the remote repository, which git created for you by default when you were in clone.
You can view the remote warehouse address pointed to by origin with the command:
Git remote-v
Output result:
Origin https://github.com/gozhuyinglong/blog-demos.git (fetch) origin https://github.com/gozhuyinglong/blog-demos.git (push)
This command displays the name and address of the read-write remote repository, which I point to here is Github.
1.2 remote warehouse renaming
Since this address is Github, for easy identification, change the name to github. Enter command: git remote rename
Git remote rename origin github
Enter the command to view the remote warehouse, verify whether it is successful, and output the result:
Github https://github.com/gozhuyinglong/blog-demos.git (fetch) github https://github.com/gozhuyinglong/blog-demos.git (push)
Success!
1.3 add another remote warehouse
Let's add a remote warehouse on Gitee, first creating an empty warehouse on Gitee with the same name as on Github.
Then copy the address at Clone / download.
Output add remote warehouse command: git remote add
Git remote add gitee https://gitee.com/gozhuyinglong/blog-demos.git
Then verify whether it is successful, and output the result:
Gitee https://gitee.com/gozhuyinglong/blog-demos.git (fetch) gitee https://gitee.com/gozhuyinglong/blog-demos.git (push) github https://github.com/gozhuyinglong/blog-demos.git (fetch) github https://github.com/gozhuyinglong/blog-demos.git (push)
Success!
1.4 push / pull of more than one remote warehouse
With multiple remote repositories, push and pull can no longer be git push and git pull as before, and the name of the remote warehouse must be added to identify which remote warehouse is operating. Commands are as follows: git push, git pull:
Git push github maingit pull github maingit push gitee maingit pull gitee main
If you don't want to take a branch with each operation, you need to associate the local branch with the remote branch: git branch-- set-upstream-to=/
Git branch-set-upstream-to=gitee/main main
After the association, you can not specify the branch.
Git push githubgit pull githubgit push giteegit pull gitee1.5 removes a remote warehouse
If you want to remove a remote repository, use the following command: git remote remove or git remote rm
Git remote remove gitee
After you remove the remote warehouse, all local branches and configuration information of the warehouse will also be deleted.
two。 Common mistakes and Solutions
Of course, the above operation is not plain sailing, if you encounter some mistakes, here may be the answer you want.
2.1 prompt that no branch is specified
When pulling the Times under the error:
You asked to pull from the remote 'gitee', but did not specifya branch. Because this is not the default configured remotefor your current branch, you must specify a branch on the command line.
Indicates that the local branch is not associated with the remote branch. Just associate it. Execute the following command: git branch-- set-upstream-to=/
Git branch-- set-upstream-to=gitee/main main2.2 does not have permissions for the repository
When a push operation is performed, the following information is prompted:
Remote: You do not have permission push to this repositoryfatal: unable to access' https://gitee.com/gozhuyinglong/blog-demos.git/': The requested URL returned error: 403
Indicates that there is no permission for the remote warehouse, you should first check whether the remote warehouse is public, and then check whether the local account and password are correct.
2.3 the remote warehouse is not made public
Log in to Gitee and check whether the code base is a company. If it is not made public, it is set to public.
2.4 incorrect account number and password in Windows credentials
Open the control panel and click "user account"
Then click "manage Windows credentials"
Find your account number and change your account number and password.
2.5 Delete Windows credentials and log in again
You can also delete your Windows credentials directly, and when you execute the push command, the Windows Security Center login box will pop up.
Just enter your account number or password.
2.6 unable to eject Windows Security Center login
If the Windows Security Center login box cannot be popped, uninstall it and execute the following command:
Git credential-manager uninstall
Download and install again at https://github.com/microsoft/Git-Credential-Manager-for-Windows/releases
2.7 the login box pops up every time Github is pushed, and the SSH address can be used.
As shown in the figure below, every time you push code, the login box below pops up.
We can change the remote address to the SSH address:
Remove the current github address and add the ssh address again, as shown in the above code.
After adding the address, you also need to set SSH Key on the github
2.8Generate SSH Key and add it to Github
Enter the following command to generate SSH Key, and fill in your login email address in double quotation marks
Ssh-keygen-t rsa-C "xxxxx@xxxxx.com"
If the following prompt pops up, enter directly. (if it already exists, you will be prompted whether to replace it or not, enter Y and enter)
The public key will be generated in your disk directory [C:\ Users\ your user name .ssh\] and the memory in the file [id_rsa.pub] will be copied.
Open the [SSH and GPG keys] page of github and add:
This is the end of the content of "how to submit the code to both Github and Ciyun Gitee". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.