Wednesday, March 11, 2020

Working with github repository

It's been more than 5 years, I don't really work on any programming project. All my git/perl knowledge are gone. I was stunt a bit when looking back my documentation at Basic commands of git.

I have cleaned up my github account, and start new repository to host the files and scripts on a database related research that I am working on. Spent some time to read some more git commands online, and the instruction on github, finally I manage to link my local repository with the github repository that I created. It took me quite sometime to get things right. :(

Here's the step.

1. Create a github repository.

2. Create a local git repository.
> git init

3. Add the github repository as our origin
> git remote add origin<your github repository>

4. Clone the github repository to local (If you have files in the github repository already)
> git clone<your github repository>

5. Create a branch in local
> git checkout -b <branch name> origin/master

6. Make commits

7. Push to github repository
> git push origin <branch name>

Then... I found an easier way... And, work on the trunk only.

1. Create a github repository.

2. Clone your github repository
> git clone<your github repository>

3. Make commits

4. Push to github repository
> git push origin master

Some other git commands
To set user name and email only for this current local git repository

> git config "<your email>"
> git config "<your name>"

Again, please refer to git cheat-sheats for more command. :)

No comments:

Post a Comment