简体   繁体   中英

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 git@github.com: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!

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 git@github.com:username/somerepo.git

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

5)????

6) Proffit

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

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

After created you project on github, you have :

  1. To clone you project in local, used git clone git@github.com: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.

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 git@github.com/[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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM