-2

I am a new programmer and also a brand new working with git. As my first assignment as a contributor to developing a program, I have been asked to install git and did these two steps:

  • change to the directory under which you want to have the source tree
  • let git checkout the source

I have understood that what the purpose of using git is but haven't understood what is meant by changing to directory. Should I change to my local directory or the remote directory somewhere in the server?

I have understood that checkout is somekind of copying the code in my local computer if I am not mistaken. But the git checkout command does not work in github. Should I perform other steps before using this command or the problem is with changing the directory? Any thoughts?

deceze
  • 510,633
  • 85
  • 743
  • 889
Sara M
  • 17
  • 1
  • 7

1 Answers1

1

Changing the directory means that you need to go to your directory where you want to have your source code.

For example, on Linux, you may have ~/Documents/GitProjects directory so you need to change to it like this:

$ cd ~/Documents/GitProjects

Regarding Git checkout, you've got it right. You need to get the source code of your repo in your local machine. For example, you have a Git project named MyTestProject under your Git user e.g. SaraM, you can clone that source like this:

$ git clone https://github.com/SaraM/MyTestProject

Your repo MyTestProject will be cloned and you can start working on it.

Make sure that you've added your machine's SSH key into your GitHub account to clone the repo using SSH URL or you may use HTTPS URL for cloning.

Hope that helps!

Azeem
  • 11,148
  • 4
  • 27
  • 40
  • 1
    Thank you for your answer Azeem. – Sara M May 02 '18 at 08:44
  • The confusing point is that in step by step readme file there is no clone step but only checkout step.and when i try to clone with my credential, the access is denied. – Sara M May 02 '18 at 08:57
  • @SaraM: Well, git checkout is used to select a specific branch. If you have the concept of branches in Git then you'll know what it is about. I'd suggest to upload your ReadMe file in your question. Are you using GitHub? How are you cloning? HTTPS? SSH? – Azeem May 02 '18 at 09:00
  • --) Checkout the EyeTrace source tree - Launch the program 'Git Bash' that you just installed. - change to the directory under which you want to have the source tree (e.g. `cd /c/Users//Documents`) - let git checkout the source: `git checkout .../EyeTrace-NG.git` that is the content of my read me file.i use Https. – Sara M May 02 '18 at 09:08
  • @SaraM: So, you are on Windows! Use these commands: `$ git clone `. Does this work? – Azeem May 02 '18 at 09:18
  • yes i am on windows! this is the command which asks for my credential and returns error although the credential is correct – Sara M May 02 '18 at 09:30
  • Host key verification failed. – Sara M May 02 '18 at 09:49
  • @SaraM: That's because you are using SSH address for cloning and you haven't added your machine's SSH key into your GitHub account. Go to the repo that you're trying to clone and there'll be a `Clone or download` button. Select `Use HTTPS` and copy that URL and use that for clone. – Azeem May 02 '18 at 09:55
  • 1
    very helpful!yes by adding the sshkey it works fine.tanx – Sara M May 02 '18 at 10:40
  • @SaraM: That's good! I'm updating my answer with the SSH key aspect. You may accept it to close this thread. Thanks! – Azeem May 02 '18 at 11:26