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