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 to add remote Warehouse by linux

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "how to add a remote repository for linux". Xiaobian shows you the operation process through actual cases. The operation method is simple and fast, and the practicality is strong. I hope this article "how to add a remote repository for linux" can help you solve the problem.

Thinking:

One. Command Required for Remote Repository

Two. Register and set up a remote repository via the website

Three. Example actions How to place documents in a remote repository

One. Remote Warehouse Related Commands

Check out warehouse: $ git clone

View remote repository: $ git remote -v

Add remote repository: $ git remote add [name] [url]

Remove remote repository: $ git remote rm [name]

Modify remote repository: $ git remote set-url --push [name] [newUrl]

Pull remote repository: $ git pull [remoteName] [localBranchName]

Push remote repository: $ git push [remoteName] [localBranchName]

* If you want to commit a local branch of test to a remote repository as the master branch of the remote repository, or as another branch named test, the following is true:

$git push origin test:master? ? ? ? //commit local test branch as remote master branch

$git push origin test:test? ? ? ? ? ? ? //submit local test branch as remote test branch

Two. Log in Create a new account

1. Register an account first, create your own git, click repositions, click new

2. Name custom (testgit), then select public, click create repository

3. Add key: Click your avatar in the upper right corner, select settings, select SSH and GPG keys on the left

4. Click New SSH key on the left and paste the contents of--/.ssh/id_rsa.pub on the linux machine here.

Note: Local operations

key Generate a secret key on the server

ssh-keygen

The remote repository places the generated key, and automatically receives an email after adding it.

5. Push local repository to remote repository

This machine enters the home directory

Create testgit repository locally and enter repository directory

Initialize Warehouse

git init

6. git remote add origin git@github.com lizheng103/testgit.git (lizheng103 is the computer name, testgit is the repository name)

Testgit, a repository created remotely, should have the same name as the local repository.

Three. Instance creates a document and pushes it to a remote repository

1. create a file

vi test.txt

2. git push-u origin master //push local testgit repository to remote testgit

View new remote repository content

3. Modify the document before viewing the contents of the repository

vi test.txt modify content

git add test.txt

git commit -m "change test.txt"

After modification, push the local file to the remote repository

git push

Modified warehouse contents

8. Every time you push again, you can directly git push.

About "linux how to add remote repository" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.

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

Development

Wechat

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

12
Report