Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Looking for help with GIT

Discussion in 'Getting Started' started by unity_xarzu, Dec 23, 2021.

  1. unity_xarzu

    unity_xarzu

    Joined:
    Dec 23, 2021
    Posts:
    12
    I have just started using git.
    I have created a repository.
    Then, as I was instructed, I made a “git clone” command which consisted of “git clone” followed by a path.
    I expected this to get the contents of the path and put it into my repository – meaning the directory I made. This did not happen. What do I do?
    How do I get a local copy of a remote work space for me to work on?
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    The path should be the URL to your repository.

    For example, if your repository is hosted on GitHub:
    git clone https://github.com/<your-github-username>/<your-repository>.git
     
  3. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,658
    Last edited: Dec 24, 2021
  4. unity_xarzu

    unity_xarzu

    Joined:
    Dec 23, 2021
    Posts:
    12
    How do I get a local copy of a remote work space for me to work on?
    I mean, I want to copy the code down to my local hard drive. I know that the path is in the URL to my repository but that does not answer my question.
    Am I supposed to use a "pull" command?
     
  5. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    That is what
    git clone
    does.

    You shouldn't need to manually run a
    git pull
    , as
    git clone
    is supposed to automatically fetch, checkout, & pull from the main/master branch, but you can try running a manual
    git pull
    anyway.

    If you're not seeing any files in your local repository, then it's because your remote repository doesn't have any files committed to the main/master branch. Does your repository have other branches? If so, you'd need to checkout to the branch that has the files you're looking for.

    You can run
    git branch -r
    to list all the branches your remote repository has, then run
    git switch <name-of-remote-branch>
    to create a local copy of that branch.
    git switch
    will also
    git pull
    from the remote branch automatically as well.
     
    Last edited: Dec 24, 2021