简体   繁体   中英

Setting up git repository with local environment [e.g. virtual environment]

I have a directory containing files of a git repository along-with some lib and bin files file. But there is no versioning system in the folder(no .git folder).

How do I setup git repository for my local use, which is in sync with remote git repository along with bin-files which already exist in local folder ?

You can initialize a new git repository by typing git init within your working directory.

This will create the .git directory. Then you need to tell git where the remote is, so go to github.com and create a new repository.

When you create it go to your working directory and type:

git remote add origin https://github.com/user/repo.git

and replace user and repo with the appropriate fields.

The first thing you ll have to do is create your initial commit. Typically the initial commit is the README file:

touch README.md
git add README.md
git commit -m "Initial commit"
git push origin master

After you do that, your README file should appear on github.com under the repository you created.

The next step is push your current bin-files to remote. Assuming you want to track all of the files in your working directory do this:

git add . which will add all of your files in version control.

Then commit your changes git commit -m "Your commit message" and push them to the remote 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