Shared warehouses, remote warehouses, multi-person collaboration, GitHub operations

Source: Internet
Author: User

1. Shared Warehouses:

Create a shared warehouse
1. Create a folder
mkdir file
2. Set folder owner
Chown Tarena:tarena File
3. Set this folder as a shareable git repository
CD file
Git init--bare file1.git
4. Set up the local warehouse owner
Chown-r Tarena:tarena File1.git

2. Remote warehouse push-Pull project:

Add a remote repository
git remote add origin [email protected]:/home/tarena/gitrepo/project.git

To push code to a remote warehouse
Git push-u Origin Master
* The first time you push the code, add-u option

Delete remote Name
Git remote RM [Origin]

To get a project from a remote repository:
git clone [email protected]:/home/tarena/gitrepo/project.git

To pull a branch or code from a remote repository:
Direct pull remote Branch and current work branch merge
Git pull Origin Dev_tom
Pull remote Branch to local, do not merge
Git pull Origin Dev_tom:dev_tom
Remote Branch name local branch name

3. Multi-person collaboration is a push project:

Developer 1:git Add, git commit, git push (OK)

Developer 2:git Add, git commit, GIT pull Origin master--git push

4. Work with GitHub:

(1) Add SSH key:

1. Generate SSH keys on localhost
Get Ssh:ssh-keygen in Liunx
* The default key is stored under ~/.ssh/
* The build process will prompt for a password, if the direct carriage return means no password is set
2. Enter ~/.ssh directory to replicate id_rsa.pub public key content
3. Login to the GitHub account, in the top right corner of the Avatar drop-down menu-->settings--> left ssh and GPG keys-->new ssh key--> fill in the title, copy the content into the key text box, click Add ...

(2) Create a new GitHub repository:
Top right + drop-down menu--new repository--fill in the reference name and basic description, choose whether to add content such as Readme or not, select public or private--complete

(3) Operate the GitHub repository:

1.git remote GitHub Repository, if you need to enter a password to enter the GitHub password
2. Use git push to manipulate remote repository operations

Shared warehouses, remote warehouses, multi-person collaboration, GitHub operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.