Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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,670
    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