Darkgates
Darkgates

Reputation: 21

local pc's folder to github folder?

i am new in git. I created a folder in my Github with an intention to save some of my works from local computer. So i connected my local folder to remote folder, but i didn't use "git push -u origin master" command. Because I feel like the name of remote folder (folder that i created in github) isn't appropriate, so delete the folder and created another folder. Now i try to push my folders to new folder that i created in github. But it won't let me push the folder to github. i try using "git reset" command, but didn't work

Upvotes: 2

Views: 888

Answers (1)

Pbd
Pbd

Reputation: 1319

How to setup your local repo and add it to github

  1. Github clearly documents the steps but I'll repeat anyways.

    1. Create the repo on github.com.
    2. Copy its link which generally is of the form github.com/<user_name>/<repo_name>.git
    3. This link is also called remote.
  2. Create your local directory.

    1. mkdir <my_dir>

    2. Name of your local directory need not necessarily match the one of remote but it is a good convention nonetheless.

    3. Initialize the directory by git init so that it is now covered by git. It need not be empty and can have some contents. You just need to ensure that you are root of your project that you are syncing to github.

    4. Now add your github location to your local directory so that you can sync your changes to github. git remote add origin <point_1.2>

    5. Your local directory is now connected to github and now you can use git push to sync your local changes to github.

If you are changing your remote repo, you just need to repeat all steps from 1) and then do the one in 2.4).

Upvotes: 1

Related Questions