Adding a local project to the GITHUB

1. Install GIT in Linux

sudo apt-get install git

or Synaptic Package Manager > git.

 

2. Create a repository in github (eg : CamelInAction)

repo-create

 

3.cd to the local project directory. (cd /rezsystem/workspace/CamelInAction)

 

4. Initialize the local project directory as a Git local repository.

git init

 

5. Add the git related files in to your new local repository. This stages them for the first commit.

git add .

6. Commit the files that you’ve staged in your local repository. Here, this will commit the tracked changes and prepares them to be pushed to a remote repository.

git commit -m 'First commit'

In this case, you may get a below like warning.

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'namal@namal.(none)')

In this case, run the config commands as below.

git config --global user.email "namal@yahoo.com"
git config --global user.name "namalfernandolk"

 

7. Copy the remote repository URL.(GitHub repository, in the right sidebar)

copy-remote-repository-url

 

8. In Terminal, add the URL for the remote repository where your local repository will be pushed.
– Sets the new remote

git remote add origin https://github.com/namalfernandolk/CamelInAction.git

– Verifies the new remote URL

git remote -v

9. Push the changes in your local repository to GitHub. Here, it will pushes the changes in your local repository up to the remote repository you specified as the origin.

git push -u origin master

Here, In this step if you are getting 407 error.(eg : error: The requested URL returned error: 407 while accessing https://github.com/namalfernandolk/CamelInAction.git/info/refs
), add the proxy authentication details as (proxy = http://username:passwd@your-proxy-ip:your-proxy-port) to the git conf file. This will be the /rezsystem/workspace/CamelInAction/.git/conf file or .gitconfig file that is located in your $HOME folder.

Reference :

Leave a comment