简体   繁体   中英

Git, adding a new repository

I am using Bitbucket, I created a new repository on their website called Project .

Now within a folder called Project on my desktop, I run:

$ git remote add origin https://user@bitbucket.org/group/project.git

However, when I push to this origin after comitting files, it changes the path instead of just uploading the files within the folder.

Eg, instead of uploading just the files within the Project folder, so when I click on "source" it's the same as viewing the Project folder on my desktop, it's adding two extra folders (Desktop & Project) like so:

Desktop/Project/...

Why is this? When I click on repository source on the website, I should only see all the files like I would if I was inside my Project folder on my desktop. But instead there is a Desktop folder, then within that a Project folder, THEN there are my files.

What am I overlooking? I hope I explained properly.

You need to properly initialize your working repository

git init        # this will initialize git repo(do it in Project folder at your desktop)

You have added the remote properly as :

git remote add origin https://user@bitbucket.org/group/project.git

Even you can name your remote as per your choice :

 git remote add <remote name> <your repo url>   # link the remote url and name it

Now you can add your changes and commit the code and push it up

You can go through https://try.github.io/levels/1/challenges/1 and have some try-outs

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