Tuesday, 27 June 2017

How to create/clone/push a github repository


1. Open "https://github.com/"

2. login

3. Click "Start a project"
    點擊 "Start a project"



4. name your repository and click "Create repository"
    填上你的repository 名稱然後點擊 "Create repository"

5. It redirect to your repository  as below image
    5.1 Click "Clone or download"  點擊 "Clone or download"
    5.2 Copy "HTTPS"'s the web URL 複製 "HTTPS"的Web URL

  example :https://github.com/kennethhutw/AspNetCoreMvcToDoApp.git

    PS: if it is not HTTPS, please click "Use HTTPS" 如果不是HTTPS ,請點擊旁邊的 "Use HTTPS" 如圖下


6. open your command line on windows 打開你的"命令行"

    Type git clone, and then paste the URL you copied in Step 5.
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY

7. Press Enter. Your local clone will be created.  按"Enter" 會複製與建立本地repository 
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
Cloning into `Spoon-Knife`...
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (8/8), done.
remove: Total 10 (delta 1), reused 10 (delta 1)
Unpacking objects: 100% (10/10), done.

reference URL - https://help.github.com/articles/cloning-a-repository/

8. The repository folder is created on your path.
    repository 資料夾會建立在你的路徑上


9.    Type cd YOUR-REPOSITORY, and Type git status  check your repository


10.   Add the files in your new local repository. This stages them for the first commit.
  1. git add .
    # Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

11. Commit the files that you've staged in your local repository.
git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

12   Type Git remote -v ,  check your remote. If it does not exist, please add a remote


For example:
git remote add origin https://github.com/user/repo.git
# Set a new remote

git remote -v
# Verify new remote
origin  https://github.com/user/repo.git (fetch)
origin  https://github.com/user/repo.git (push)

13. Push the changes in your local repository to GitHub.
git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin












No comments:

Post a Comment

how-to-recursively-create-subfolder-in-each-folder-of-a-directory-in-cmd

test.cmd: @echo off setlocal for /f "usebackq tokens=*" %%a in (`dir /b /a:d`) do ( rem enter the directory pushd %%a echo...