GitHub - 上传至remote repository操作

No local folder at the beginning: 

1. Navigate to the folder in your computer where you want to start the repository;

2. Clone the GitHub remote repo to local folder:

git clone [remote-repo-URL]

Note: This makes a copy of the specified repository, but on your local computer. Also creates a working directory that has files arranged exactly like the most recent snapshot in the download repository. Also records the URL of the remote repository for subsequent network data transfers, and gives it the special remote-repo-name “origin”.

3. Move into your newly created repo.

4. Add the remote repository:

git remote add [remote-repo-name] [remote-repo-URL]

Note: This records a new location for network data transfers.

git remote -v

Note: This lists all locations for network data transfers.

5. Stage and commit:

 $ git add [file/folder name]
 $ git commit -m "This is the message you can input"

6. Push these changes to the master branch on the origin remote repo.

git push origin master

Note: origin can be the name you write in step 4, master is the branch

p.s I do not fully understand branch and the name for this stage, just use this line is ok for me right now.

7. (option) Get the most recent copy of the files as seen in remote-repo-name

git pull [remote-repo-name] master: 

In local folder at the beginning: 

1. In the local work spot, add the remote repository:

git remote add [remote-repo-name] [remote-repo-URL]

Note: This records a new location for network data transfers.

git remote -v

Note: This lists all locations for network data transfers.

2. Stage and commit:

 $ git add [file/folder name]
 $ git commit -m "This is the message you can input"

3. Push these changes to the master branch on the origin remote repo.

git push origin master

Note: origin can be the name you write in step 4, master is the branch

p.s I do not fully understand branch and the name for this stage, just use this line is ok for me right now.

4. (option) Get the most recent copy of the files as seen in remote-repo-name

git pull [remote-repo-name] master

猜你喜欢

转载自www.cnblogs.com/yy0506/p/12460213.html
今日推荐