469,955 Members | 2,606 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,955 developers. It's quick & easy.

Using GIT to get remote code

xarzu
82 64KB
I do not know from the online tutorial if I am properly establishing a connection with a git repository that is on a network.

All I have learned from a tutorial is how to set up a local repository, but getting data off of a network repository is knowledge I have yet to stumble upon or learn about and I wanted to save time by asking some online help forums.

I have just started using git after not using it for a while.
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?

I am wondering if there is something like a "fetch" command I should be using.

The video tutorial I was looking at instructed how to make a local repository. But if I am trying to get code from a network location, how do I go about making that happen?

I was instructed at my job to run this command (copied here in pseudo code)

git clone blah-blah:/blah/git/noogie/dork_monkey/

and when I did this grom git-bash it did not produce any errors which led me to think it was the command I needed to do.

But I did this from the local directory that I used

git init

to set up as a locak repository.

I assumed that typiing a "git clone..." command would have copied all of the files on the blah-blah server over.

But it did not.

I wonder if all this might have something to do with the fact that I need to get my network up and running first.

In my File File Explorer window, when I click on the "This PC" icon on the left, I can see I have five Network locationis mapped to drive letters.

But when I click on the Network icon I get an error.
4 Weeks Ago #1

✓ answered by Niheel

If you're connected to the internet and the server can be accessed without git, you should be able to fetch the contents.

git init setups a new repository for new code

when you do git clone https://github.com/example-repo/example-lib it should pull and setup a local respository of the code for you, which you can start manipulating and pushing to that

Expand|Select|Wrap|Line Numbers
  1. # get public repo
  2. git clone https://server/repo-location
  3.  
  4. # make changes
  5. git add --all  // add the changed files and folders  to git tracking
  6. git commit -m 'message with changes' // commits above changes
  7.  
  8. # commit only adds changes to your local repo, now you have to push to the public repo
  9. git push
  10.  
  11. # to get changes made from other contributors to the repo
  12. git fetch
  13.  
references:
https://git-scm.com/docs/git-clone
https://git-scm.com/docs/git-init
https://git-scm.com/docs/git-add
https://git-scm.com/docs/git-push
https://git-scm.com/docs/git-fetch

2 11026
Niheel
2,442 Expert Mod 2GB
If you're connected to the internet and the server can be accessed without git, you should be able to fetch the contents.

git init setups a new repository for new code

when you do git clone https://github.com/example-repo/example-lib it should pull and setup a local respository of the code for you, which you can start manipulating and pushing to that

Expand|Select|Wrap|Line Numbers
  1. # get public repo
  2. git clone https://server/repo-location
  3.  
  4. # make changes
  5. git add --all  // add the changed files and folders  to git tracking
  6. git commit -m 'message with changes' // commits above changes
  7.  
  8. # commit only adds changes to your local repo, now you have to push to the public repo
  9. git push
  10.  
  11. # to get changes made from other contributors to the repo
  12. git fetch
  13.  
references:
https://git-scm.com/docs/git-clone
https://git-scm.com/docs/git-init
https://git-scm.com/docs/git-add
https://git-scm.com/docs/git-push
https://git-scm.com/docs/git-fetch
4 Weeks Ago #2
xarzu
82 64KB
I double checked my network connection and tried again.

This time, I was prompted to give a password but all of my attempts failed. So, can it be that I just don't have the permissions? Could it be that I don't have network access at all?
3 Weeks Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by SimonH | last post: by
3 posts views Thread by A. K. Bhardwaj | last post: by
2 posts views Thread by Rob R. Ainscough | last post: by
reply views Thread by John Holmes | last post: by
reply views Thread by Mitkip | last post: by
5 posts views Thread by pyapplico | last post: by
4 posts views Thread by chris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.