Git push

Work together, we need a copy from a remote repository cloned into the machine, and put inside Add / Edit the file, and then submitted the final push to the remote repository.

Here we demonstrate complete this process.

1, has read and write permissions on cloning a warehouse github.

Here switching to read and write permissions on items github account cloning

1
2
3
4
5
正克隆到  'gitDemo' ...
remote: Counting objects: 3,  done .
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3 /3 ),  done .

2, was cloned into the network just to the directory of the

cd gitDemo

The following step is to add a few files

 

 

 

 

3, create a file hello.txt inside, free to write content

# vi hello.txt

4, add files to the staging area

Use the command git add file name, file name may be wildcard *

# git add hello.txt

5, submitted using the git commit command

Use the form below: git commit -m "commit"

1
2
3
4
# git commit -m "添加 hello.txt"
[master 7c1b9ee] 添加 hello.txt
  file changed, 1 insertion(+)
  create mode 100644 hello.txt

6, push the machine to replace the remote repository

Use git push command

1
2
3
4
5
6
7
8
9
10
# git push
Username  for 'https://github.com' :        # 这里要输入github账号
Password  for 'https://[email protected]' :      # 这里要输入github账号密码
Counting objects: 4,  done .
Compressing objects: 100% (2 /2 ),  done .
Writing objects: 100% (3 /3 ), 294 bytes | 0 bytes /s done .
Total 3 (delta 0), reused 0 (delta 0)
To https: //github .com /xxx/gitDemo .git
    1d54d92..7c1b9ee  master -> master
[root@localhost gitDemo] #

Guess you like

Origin www.cnblogs.com/max-hou/p/12040289.html