scorpiozj
scorpiozj

Reputation: 2687

manage project on github

I want to put my project to the github, but I always failed. I use following steps to do it:

  1. create a new repository on github,
  2. In my disk, I create a folder LocalGit and initial it. Then I use git pull [email protected]:myAccount/myProject.git
  3. I add the project directory TestPro to the LocalGit, and then using: git add . git commit -m "inital"
  4. Finally, I try to push it to the github, using : git push -u origin master

After that, I open the github in safari, and my project exists. But the problem is the folder TestPro can't be open, and there is nothing under it.

Could anyone tell me how to add existing project to the github? I have read the instructions on github, but I still can't find the solution and where am I wrong.

The local project I refer is a local git repository. Does it matter? should I checkout it first?

Thanks!

Upvotes: 0

Views: 605

Answers (5)

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34318

The steps are :

1. cd "/path/to/project_folder"
2. git init
3. git add .
4. git commit -m "Your Message"
5. git remote add github https://github.com/[your_user_name]/[repo_name]
6. git push origin master

or, if you want to clone first. Then,

1. git clone [email protected]/[your_user_name]/[repo_name]

Then, you can make changes to the files that you cloned.

Next, use the following commands :

2. git add .
3. git commit -m "Your Message"
4. git remote add github https://github.com/[your_user_name]/[repo_name]
4. git push origin master

Upvotes: 0

jerome
jerome

Reputation: 54

After created you project on github, you have :

  1. To clone you project in local, used git clone [email protected]:myAccoun/myProject.git
  2. touch test;git add test;git commit -a -m "first commit"
  3. after you right : git push origin master

git pull is git fetch and git merge. Used it after to refresh your repository. .git is automatically manage by git, so it's no necessary to add to track.

Upvotes: 0

Gihan
Gihan

Reputation: 4283

You have to add the remote location before pushing it. git remote add origin [email protected]:myAccount/myProject.git http://help.github.com/create-a-repo/ Go to the "more about remotes"

Upvotes: 0

VonC
VonC

Reputation: 1323313

If you have created a new repo on GitHub, the simplest way to use it is:

  • to clone it locally (which defines a remote 'origin' in that local repo)
  • copy your project in that local cloned repo
  • push

Upvotes: 0

sl4mmer
sl4mmer

Reputation: 371

After creating repo on github

1) configure ssh-keys, then set your git.username and git.email

2) Clone repo using git clone

git clone [email protected]:username/somerepo.git

3) Make changes, commit it to local repo and push to remote by git push

5)????

6) Proffit

Upvotes: 1

Related Questions